GREAT MILLS, Maryland - An armed school resource officer faced off with a student who opened fire at a high school in southern Maryland on Tuesday morning.

St. Mary's County Sheriff Tim Cameron said at a press conference that a male student shot two students in a hallway at Great Mills High School before classes started.

The officer then engaged with the gunman, and each fired one shot simultaneously, the sheriff said.

"The incident ended there," Cameron said earlier in a live interview with CBS affiliate WUSA-TV.

The sheriff's office later identified the school resource officer as Deputy First Class Blaine Gaskill.

Just before classes were set to begin at Great Mills High School, Tuesday, March 20, 2018, a student shot and wounded a 16-year-old female student and a 14-year-old male student with a handgun in the hallway, according to Cameron.

The sheriff announced at the press conference that the gunman died about two hours after shooting. Cameron said that an investigation would determine whether the single round the officer fired hit the shooter.

A female student who was wounded in the shooting was listed in critical condition. A male student was listed in stable condition. They were both being treated in separate Maryland hospitals. The resource officer was not injured.

The school,  which has about 1,600 students, is near the Patuxent River Naval Air Station, about 65 miles southeast of Washington.