Updated

A former college student has pleaded guilty to attempted murder for shooting at his math professor in a northern Virginia classroom.

Police arrested 21-year-old Jason M. Hamilton of Manassas in December 2009 after he opened fire on the Woodbridge campus of Northern Virginia Community College. At a plea hearing Monday, Prince William police detective Brian Cavanaugh said Hamilton fired two rifle shots at his professor because he was upset with his grade. No one was hurt.

Hamilton's defense attorney Juan Estevez said his client has serious mental health problems that he hopes the judge will take into account at sentencing. Hamilton faces a prison sentence of two to 20 years.

Prosecutor Paul Ebert said a doctor determined Hamilton has mental health problems but is not criminally insane.