RAPID CITY, S.D. (AP) — A man accused of threatening Rapid City police officers with a butcher knife has pleaded guilty but mentally ill to two counts of aggravated assault on a law officer.

Prosecutors in exchange are dropping charges of attempted murder and destruction of public property against Elijah White Magpie.

White Magpie was shot and wounded by police in February after he allegedly threatened officers who responded to a disturbance at the public library.

Authorities allege that White Magpie had been using alcohol and marijuana before he threw a rock through a window at the library, shattered a window in a parked van, threatened one officer and attacked another. He was shot twice by an officer.

He faces up to 50 years in prison when he's sentenced on Jan. 7.

Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

More From KXRB