Minneapolis (AP) — The man who carried out a deadly shooting in a Minneapolis apartment building had been investigated in June after displaying a handgun, but wasn’t charged, the county prosecutor said Thursday.

Carlton Johnson was killed by police who raced to the building after the first reports of gunfire, said Drew Evans, superintendent of the Minnesota Bureau of Criminal Apprehension, the state investigate agency.

Court documents say Johnson was facing eviction and had threatened a fellow resident with a gun in the months leading up to the shooting, which left two people dead, along with Johnson, and five others injured.

But the shooting began just outside the building’s entrance during an arranged custody handoff, when Johnson shot and wounded a woman believed to be the mother of his child, Evans said. The child was not injured.

He then shot two building employees before taking an elevator to the 9th floor where he killed two building residents and then was killed in an exchange of fire with police. Evans said it was unclear if Johnson was targeting the residents or had simply encountered them in the hallway.