Updated

The Maryland high school student who fatally shot a classmate last week and injured another died from a self-inflicted gunshot, officials said Monday.

Austin Wyatt Rollins, 17, shot himself in the head at Great Mills High School Tuesday after opening fire in a hallway with his father's legally-owned handgun, the St. Mary's County Sheriff's Office said.

4daa8f4a-

Austin Wyatt Rollins died from a gunshot to the head, officials said. (File)

Just before 8 a.m. on Tuesday, Rollins "fired a single shot from a handgun" in a school hallway, which hit both Jaelynn Willey, 16, and Desmond Barnes, 14, according to officials.

Rollins continued to walk throughout the school before engaging with the school's armed resource officer, Deputy Blaine Gaskill. Both Rollins and Gaskill "simultaneously" fired, but Rollins "fired one fatal shot to his head."

Gaskill's shot "struck the weapon in Rollins’ hand." Initial reports in the wake of the shooting were unclear whether Rollins committed suicide or was shot by the deputy.

jaelynn willey

Jaelynn Willey, 16, who was shot at Great Mills High School on Tuesday, was pulled off life support after her family said she was brain dead. (Courtesy of the Willey family)

Willey, who police said "had a prior relationship" with Rollins "which recently ended," died Thursday after her family pulled her off life support.

Barnes was hit in the leg during the incident, and has since been released from the hospital, according to The Baltimore Sun.

Student Gun Protests

A sign from Maryland's Great Mills High School is seen in the crowd during the "March for Our Lives" rally in support of gun control, Saturday, March 24, 2018, in Washington. (AP Photo/Alex Brandon)

The school shooting came just weeks after 17 people were massacred at Marjory Stoneman Douglas High School in Parkland, Florida. Students from both schools participated in the March for Our Lives demonstration in Washington, D.C. in protest of gun violence over the weekend.