A 17-year-old student was injured when police say Robert W. Gladden Jr. opened fire in the cafeteria at Perry Hall High School in August, The Baltimore Sun reported.
Gladden pleaded guilty to attempted first-degree murder and use of a firearm in a violent crime. He had faced 29 charges.
George Psoras Jr., Gladden's attorney, had argued at a hearing earlier this month that the teenager should be tried as juvenile, but Baltimore County Circuit Judge Robert E. Cahill Jr. ruled he would tried as an adult.
Sentencing is set for Feb. 25. Gladden faces up to 40 years in prison.
'Happy' fan videos make Pharrell cry [VIDEO]
Pistorius testifies he didn't consciously pull trigger when he shot girlfriend