Updated at 5:05 p.m. ET

Two students were injured when another student opened fire at Great Mills High School in St. Mary's County, Md., according to the local sheriff. The shooter, identified by the sheriff as 17-year-old Austin Wyatt Rollins, was confirmed dead after being taken to a hospital.

"A male student produced a handgun and fired a round, wounding a female student and another male student in a hallway of Great Mills High School just before classes" began at about 7:55 a.m. Tuesday, St. Mary's County Sheriff Timothy Cameron told reporters at a news conference.

The two victims have been taken to local hospitals. The male student, 14, is in stable condition, and the female student, 16, is in intensive care with "life-threatening critical injuries," Cameron said.

A school resource officer engaged the shooter after he started firing, quickly containing the situation, Cameron told reporters. Deputy First Class Blaine Gaskill "fired a round at the shooter; simultaneously, the shooter fired a round as well," Cameron said. They are investigating whether the officer's rounds struck the shooter; the sheriff added that Gaskill was not injured.

Deputy's troopers and school nursing staff immediately administered first aid, including CPR, to the victims, Cameron said.

"There is an indication that a prior relationship existed between the shooter and the female victim," Cameron added. "We are working as we speak to determine if that was and, if so, the extent of that and if it was part of the motive for this shooting."

Further information about Rollins was not immediately available. A Facebook page under the name of"Austin Rollins" depicted a teenager who attends Great Mills High School and is interested in car racing and kayaking. Within hours of the shooter identification, the page was altered to indicate that Rollins is deceased and much of the information on it is no longer visible.

"Austin Wyatt Rollins" was listed in the school's honor roll multiple times, as reported by local media.

Witnesses to the shooting were questioned at a secured area in the high school, the sheriff said.

The school district said the school was being evacuated and that the rest of the students were taken to Leonardtown High School, where they met up with parents in pouring rain.

They "embraced, shared hugs, tears and reassurances," as WAMU's Patrick Madden reported from the scene. Among them was 15-year-old Bethany Morgan and her dad, Brian.

"Everybody just said, 'What was that noise?' and my teacher went out and said somebody was on the floor," Morgan told Madden. "Right in the moment, it was really scary. I don't want to go through it again."

Great Mills High School is located in southern Maryland, about 60 miles southeast of Washington, D.C.

The FBI and the Bureau of Alcohol, Tobacco, Firearms and Explosives said their agents are on the scene assisting the sheriff's department.

"This is what we train for, this is what we prepare for, and this is what we pray we never have to do," said the sheriff. "And on this day, we realize our worst nightmare: that our greatest asset — our children — were attacked in one of our places, a bastion of safety and security, one of our schools."

According toThe Bay Net, a southern Maryland news site, authorities investigated potential threats to Great Mills High School last month after reports circulated on social media.

The news site said the school principal said in a letter to parents that the school and law enforcement assessed the threat and that it "has not been validated at this time." At Tuesday's press conference, the sheriff said authorities are investigating whether anything on social media is linked to this attack.

The 17-year-old shooter likely did not have legal authorization to possess the gun. As The Associated Press reported, "In Maryland, a person must be 21 to possess a handgun, unless carrying one is required for employment."

The shooting comes just over a month after the shooting that killed 17 people at Marjory Stoneman Douglas High School in Parkland, Fla.

"That's what we're talking about right now across the country," Cameron added. "The notion of 'it can't happen here' is no longer a notion."

Last week, tens of thousands of students from across the country walked out of classrooms to call for firmer action against gun violence. Mass demonstrations are expected this weekend in Washington, D.C., in favor of stricter gun regulations, a protest organized by Parkland shooting survivors.

Emma Gonzalez, a Parkland student who has been outspoken in calling for tighter gun laws, tweeted a message of support for Great Mills students.

Maryland Gov. Larry Hogan said in a statement that he was praying for the Great Mills community. "But prayers are not enough," Hogan said. "Although our pain remains fresh and the facts remain unclear, today's horrible events should not be an excuse to pause our conversation about school safety.

"Instead, it must serve as a call to action."

Copyright 2018 NPR. To see more, visit http://www.npr.org/.