Court records show man shot by police had history of mental illness