A man shot and killed his former fiancee Monday afternoon outside Chicago’s Mercy Hospital & Medical Center before opening fire on people inside the hospital, killing a police officer and a first-year pharmacy resident, according to authorities.

Police on Tuesday identified the gunman as Juan Lopez, 32. Officers said Lopez shot and killed Dr. Tamara O'Neal, an emergency room doctor, after an argument over the return of her engagement ring. The pair had been set to marry in late October, but O'Neal called off the wedding in September, WLS-TV reported.

Authorities said Lopez then shot and killed police Officer Samuel Jimenez, a married father of three who had been with the force for less than two years, and Dayna Less, a pharmacy resident who joined the hospital this year after graduating from Purdue University.

Here’s what we know about Lopez:

This undated photo posted on his Facebook page shows Juan Lopez, who police say fatally shot his ex-fiancee and two other people at Chicago's Mercy Hospital on Monday, Nov. 19, 2018. Lopez, who repeatedly shot his ex-fiancee outside the hospital before killing two people inside the building, was the subject of a protection order request filed four years ago by another woman, yet he had legally purchased several guns in recent years, police said Tuesday.

Juan Lopez Facebook page via AP

icon to expand image

Juan Lopez Facebook page via AP

Lopez had been married and divorced once before

In 2014, his wife at the time filed for an order of protection against him after he started sleeping with a gun under his pillow, where it was accessible to their child, WLS-TV reported. She also accused Lopez of going after a neighbor with a gun and pulling a firearm on a realtor during an apartment appraisal, WBBM-TV reported.

Months later, she filed for divorce, according to WBBM-TV.

Lopez was kicked out of the Chicago Fire Department training

Lopez had been training in 2014 to become a firefighter, but he stopped showing up to training after he was told that he would be disciplined for allegedly making threats against a female cadet, fire department spokesman Larry Merritt told The Associated Press.

Chicago Fire Department spokesman Larry Langford told WLS-TV that Lopez was accused of "bullying" female cadets. He was fired after he went AWOL from training, the news station reported.

Lopez bought several guns in recent years

Chicago police spokesman Anthony Guglielmi said Lopez legally purchased four guns in the last five years. He had a permit to carry a concealed firearm, according to the AP.

Lopez worked for the Chicago Housing Authority

The Chicago Housing Authority hired Lopez in February to work as an associate program specialist, WLS-TV reported.

Officials told the news station that background checks are required before employment with the housing authority. The news station reported that Lopez was approved for hire after the background check and that the agency had no history of complaints about him during his employment.

“This was an unthinkable act of violence,” Chicago Housing Authority CEO Eugene Jones Jr. said in a statement. “We are filled with overwhelming sadness and our hearts go out to the families of those who died and to all affected by this horrific tragedy.”

Lopez died Monday during the shooting at Mercy Hospital, though authorities said it was not immediately clear whether he had been shot by officers or he had taken his own life.

Authorities continue to investigate.

The Associated Press contributed to this report.