Officials were investigating how an apparently troubled man had passed the psychological test required to buy firearms.