A man with a history of mental illness was shot and killed by a sheriff's deputy outside a courthouse after he pulled a toy gun on approaching officers.

Deputies approached Jonathan McCourt (search), 47, after he parked outside the Polk County (search) courthouse Tuesday and began spray-painting phrases, including "Police Academy 7," on his white pickup truck, Sgt. Todd Dykstra said.

As deputies walked toward him, McCourt jumped on the cab of the pickup and pulled the replica gun from his waistband, Dykstra said. Deputy Keith Onley (search) then shot him.

Dykstra said McCourt was wanted on a warrant that would have allowed authorities to commit him to a mental facility. Court records show that county authorities sought commitment proceedings against McCourt last year after he threw a chair at two police officers and demanded they read him Bible passages.

More recently, McCourt had engaged in a variety of odd behavior. Last week, McCourt filed a class-action lawsuit "on behalf of any and all mental patients" seeking up to $4 trillion from a Des Moines psychiatrist, the American Psychiatry Association and three drug companies. And on Monday, he went to three local television stations, telling employees he wanted photographers to help him shoot a spoof story on trashing police cars and spray-painting them.