Elijah White Magpie entered a guilty but mentally ill plea Wednesday in Seventh Circuit Court.
The plea comes after a 31-page mental evaluation was released diagnosing White Magpie with a psychotic disorder.
As part of the plea deal, prosecutors will drop the first-degree attempted murder charge and two counts of property damage. The 20-year-old still faces two counts of aggravated assault on a law enforcement officer. Each carries a 25-year prison term.
In February, White Magpie had a large kitchen knife at the Rapid City Public Library and was frightening patrons. He asked the library staff to call police. To expedite the process, he threw a large rock through the window.
When police arrived he lunged at two officers with the knife, even after a taser was deployed.
One officer was able to get off a shot, injuring White Magpie.
White Magpie faces a maximum sentence of 50 years in prison when he's sentenced on Jan. 7.