CHICAGO (AP) — A man who fatally shot his ex-fiancee outside a Chicago hospital before killing two people inside the building was once kicked out of the city’s firefighting academy after threatening a female cadet, officials said Tuesday.

Juan Lopez, who died following the shooting Monday at Mercy Hospital, was also the subject of a protection order request filed four years ago, and he legally purchased several guns in recent years, police said.

It was unclear whether Lopez shot himself or was fatally shot by police.

Four years ago, fire department officials learned of the threats to the cadet and told Lopez that he would be disciplined. He was dismissed after he went AWOL, fire department spokesman Larry Merritt said.

Merritt did not have any details of the past threats. But they were made the same year a woman sought an order of protection against Lopez because he was incessantly texting her. Police said they have not determined if the woman was granted an order of protection. Lopez was not criminally charged.

On Monday, Lopez’s first victim was Dr. Tamara O’Neal, to whom he had been engaged. O’Neal had recently called off their engagement, and Lopez confronted her about returning the engagement ring, police said.