A number of Atlanta middle school students were inadvertently dosed with pepper spray Tuesday when a school officer used the substance to stop a fight, authorities said.

Around 9 a.m. at M.L. King Middle School, an Atlanta police officer serving as the school resource officer saw three girls fighting outside as nearly 100 students looked on, APD spokesman Officer John Chaffee said.

The officer was hit several times as he tried to break the girls apart and used pepper spray on the students who refused to cooperate, Chafee said.

“Some of the spray drifted in the wind and affected some of the surrounding students,” he said.

Paramedics were called and administered aid to the students, as per APD policy following a pepper spray deployment, Chafee said. The main complaint was a temporary stinging sensation in the eyes.

Atlanta Public Schools spokeswoman Kimberly Willis Green said the district’s procedures permit officers to use pepper spray.

“They are allowed to use it when warranted,” Green said.

The three students were each charged with simple battery and disorderly conduct, and one was additionally charged with obstruction for hitting the officer in the face, Chafee said.

—Staff writer Mark Niesse contributed to this report.