Police say suspected Maryland school shooter used his father's legally purchased handgun

March 21 (Reuters) - A 17-year-old Maryland high school student used his father's legally purchased handgun to shoot a female student with whom he had been in a recently ended relationship, police said on Wednesday.

Austin Rollins brought his father's Glock 9-millimeter pistol to Great Mills High School on Tuesday morning and shot the 16-year-old girl in a hallway, gravely injuring her, St. Mary's County Sheriff's Office said in a statement.

The shooting in Great Mills, located about 70 miles (113 km) south of Washington, came five weeks after a high school massacre in Florida and days before a student-led march in the U.S. capital for tougher gun laws.

"All indications suggest the shooting was not a random act of violence," the police statement said. "Rollins and the female victim had a prior relationship which recently ended."

Attempts to reach Rollins' family have not been successful.

RELATED: Shooting at Great Mills High School in Maryland

School resource officer Blaine Gaskill confronted Rollins and fired one shot at him, as Rollins simultaneously fired a shot, according to police. Rollins died hours later at a hospital. The officer was not harmed.

A 14-year-old student who was shot in the leg during the incident, whom the sheriff's office identified as Desmond Barnes, was released from the hospital on Wednesday, a hospital spokesman said. The female victim, identified as Jaelynn Willey by her family, remains in critical condition, the sheriff's office said.

An autopsy is being carried out on Rollins to determine whether he was killed by a shot fired by the officer or from a self-inflicted gunshot. Investigators also remain uncertain over who fired the shot that hit Barnes, a spokeswoman for the sheriff's office said.

The investigation has not found any social media threats made by Rollins, the sheriff's office said.

Kai Davis, a former classmate of Rollins, pointed to his access to a gun.

"Some of us were friends with Austin before he did this. He wasn't alone, He wasn't bullied noticeably. He wasn't some kid everyone hated. He had a girlfriend. He had friends," tweeted Davis, who transferred to another school two months ago. "But he had access to a semi-automatic glock."

The school will remain closed for the remainder of the week as the investigation continues, principal Jake Heibel said in a statement. He did not respond to a request for further comment. (Reporting by Andrew Hay and Sheila Dang; Editing by Leslie Adler)