A student gunman who killed a classmate in the hallway of their Maryland high school and wounded another fatally shot himself in the head as a school resource officer closed in on him, new details released Monday show.

The school resource officer fired a single round at the student gunman, hitting the teen’s weapon but not the teen, the St. Mary’s County Sheriff’s Office said in a statement.

Before the deputy approached, Austin Rollins, 17, had fired a single shot with his father’s handgun that left one student mortally wounded and another injured in the hallway of Great Mills High School before then taking his own life March 20, according to the sheriff’s office.

Rollins specifically targeted Jaelynn Willey, 16, after the two had recently ended their relationship, authorities said. Willey was left brain dead after the confrontation and was taken off life support three days after the shooting.

[Maryland officer praised for bringing school shooting to quick end]

Deputy Blaine Gaskill, the school resource officer at Great Mills, confronted Rollins within three minutes after Rollins fired the shot that killed Willey and injured 14-year-old Desmond Barnes in the leg. St. Mary’s Sheriff Timothy Cameron and Maryland Gov. Larry Hogan, a Republican, praised Gaskill last week for going after Rollins, saying the deputy’s actions prevented further casualties.

Gaskill’s role in confronting the shooter also thrust the high school located about 70 miles south of Washington, D.C., into the national gun control debate and discussions over whether schools should arm teachers or add more armed security on campuses.

The shooting at Great Mills occurred just days before thousands rallied in Washington and throughout the country to protest gun violence, sparked by the shooting in Parkland, Florida, that left 17 dead at a high school.

A timeline of the Maryland shooting released Monday showed Rollins arrived on campus and parked at about 7:50 a.m. before walking through the main entrance. He entered the school two minutes later before confronting Willey at 7:57 a.m. He shot her in the head once with a round that also hit Barnes in the leg. Barnes fled to a nearby classroom where a teacher called 911.

“Oh, my knee hurts bad,” Barnes is heard in a 911 recording the sheriff’s office also released Monday.

“We have help coming to you,” the dispatcher told him. “Stay strong with me, buddy.”

During the call, Barnes is heard in the background calling his mother telling her he has been shot but assuring her he is OK.

Barnes remained calm as he spoke with the dispatcher, answering “Yes, sir” repeatedly as he was in pain.

The recording captured the sounds of police officers outside the classroom door as Barnes reported that his leg was going numb.

“Stay with me, buddy,” the dispatcher said again and again.

[16-year-old victim of Maryland school shooting dies, sheriff’s office says]

Within three minutes of the shooting, Gaskill confronted Rollins in the hallway. Both Rollins and Gaskill fired their weapons simultaneously, according to the sheriff’s office. Rollins shot himself in the head with a Glock handgun that his father legally owned, and Gaskill fired, hitting the gun in the teen’s hand.

Gaskill had been assigned to the school as an officer since August.

Three released 911 calls from teachers and students convey the fear that struck the high school of 1,600 just as classes were set to begin for the day. The recordings capture the sounds of deputies in hallways, dispatchers asking callers how many shots were fired and if classroom doors are locked and teachers giving headcounts of students hiding with them.

One female caller who crouched behind a desk in room with students cowering reported she saw an injured girl in the hall.

“The girl outside, I can see with, like, a pool of blood on the ground coming from, like it … looks like her head,” the caller said.

“How many shots were fired?” a dispatcher asked.

“One shot.”

Follow the Bangor Daily News on Facebook for the latest Maine news.