The Antigo Police Department identified the gunman as 18-year-old Jakob Wagner and said he was pronounced dead at 1:06 a.m. Sunday "after lifesaving measures at a nearby hospital."

The Wisconsin Department of Justice's Division of Criminal Investigation was asked to take over the shooting investigation because an Antigo police officer killed the gunman, according to Department of Justice spokesman Johnny Koremenos, who said early Sunday afternoon that state agents "are busy assessing the facts at this time."

The latest in a decades-long series of U.S. school shootings drew immediate national attention, as high schools are holding proms across the country.

Wisconsin Gov. Scott Walker issued a statement by Twitter, crediting the responding officers with saving others from harm.

One female victim was treated for a gunshot wound at the hospital and released. The other victim, a male student, was undergoing surgery as of 11 a.m. for non-life threatening injuries, according to police.

The gunman was armed with a rifle when he started shooting people as they left the school about 11 p.m. Saturday, before an officer already on the scene shot the gunman, authorities said.

"The officer’s immediate response prevented further injuries and possible casualties," the police department said in a statement posted on Facebook. "The initial investigation and officer response indicate this was a lone shooter and a search warrant is being executed at his residence seeking any additional information pertaining to this incident."

Officers who were patrolling the school during prom heard the shots and responded. One of them shot the person with the rifle, ending the threat, according to police.

“The community is safe at this point,” Antigo Police Chief Eric Roller said during a press conference several hours after the incident.

The Unified School District of Antigo said Wagner had approached the school with a high-powered rifle and a large ammunition clip. The district said in a statement that "quick actions" taken by police and district staff to secure the building "prevented what might have otherwise been a disaster of unimaginable proportions, and we are extremely grateful for their well-rehearsed response."

The victims and suspect were initially brought to Aspirus Langlade Hospital in Antigo. One of them was discharged and two were transferred to another facility, according to a hospital official.

The relationship between the shooter and the victims was not immediately clear as of early Sunday morning, according to Roller.

A person with the same name and spelling as Wagner's name was listed in an Antigo newspaper as a high school senior in 2015 who made the honor roll in February of that year.

An autopsy on Wagner was scheduled for Sunday afternoon, Langlade County Coroner Larry Shadick said.

Antigo High School has about 800 students, according to the state Department of Public Instruction.

Reinhardt Balcerzak, a retired Antigo High School science teacher and member of the city council, said he heard about the shooting when he turned on his TV Sunday morning.

"It hasn't even sunk in yet," Balcerzak told a journalist from the Wausau Daily Herald, part of USA TODAY NETWORK-Wisconsin. "I put on Good Morning America and that's the first thing I saw. I told my wife, 'I think that's Antigo.'"