A man toting a rifle opened fire outside of a high school prom in northe Wisconsin Saturday night, wounding two students before a police officer fired on the attacker "stopping the threat," authorities said.

The shooting happened outside the Antigo High School around 11 p.m. Saturday, near the end of the event, according to WSAW-TV.

Antigo Police Chief Eric Roller told the station several officers were already on school grounds providing security for the event.

An officer on patrol in the parking lot heard the gunshots and immediately fired at the shooter, stopping the threat, Roller said, according to the station.

"At this point, we feel that we have the subject in custody that was a threat. The community is safe at this point," Roller said. "We’re also looking at the victims and hope everything comes through okay with them."

The shooting suspect was in custody. It wasn’t clear what the suspect’s relationship was to the two victims. The motive also wasn’t immediately known.

It also wasn't known if the suspect was a current or former student.

The two victims and the suspected shooter were treated at Aspirus Langlade Hospital, WSAW reported.

The victims were treated for non-life-threatening injuries, Fox 11 News reported.

After the attack, students were escorted from the prom to safety and the victims' families were notified.

Antigo, a community of about 8,000 people, is roughly 150 miles north of Milwaukee.

The Associated Press contributed to this report.