Until Juan Lopez began shooting people at Mercy Hospital on Monday, he was perfectly within the law by carrying a concealed Glock 9mm pistol.
He had purchased the firearm legally in 2012 at a Lincolnwood gun store, the ABC7 I-Team has learned, and his permit paperwork was all up-to-date when he confronted his ex-fiancée outside the hospital where she worked.
For Illinois state police officials though, the question now is: why?
RELATED: Funeral for fallen CPD Officer Jimenez to be held Monday
Why was Lopez allowed to have state permits, and that gun, when he was involved in several red flag events that apparently should have called his authorization into question?
On Wednesday, state police spokesman Matt Boerwinkle told the I-Team that Illinois investigators were reviewing the chain of communication in recent years following abusive behavior that Lopez was involved in. State police are trying to determine who knew what and when, and was that information about Lopez transmitted to the licensing and regulatory staffers who needed to know it?
A critical occurrence in Lopez' history was in 2014 when his then-wife obtained a court order of protection against him in Cook County-alleging threats of violence with a gun against her, a neighbor and a Realtor. Part of the 2014 court record obtained Wednesday by the I-Team states that Lopez "should be ordered to surrender any and all firearms to the local law enforcement agency."
RELATED: What we know about Mercy Hospital gunman Juan Lopez
Whether he surrendered the gun bought in 2012 (and used this week at Mercy Hospital) is not reflected in the court record. The Cook County order of protection was in effect less than three weeks-long enough for Lopez to move out of the home he shared with his estranged wife and their young son. It is possible that he surrendered his gun-or guns-and then had them returned once the court order expired.
But there is also a looming question for state authorities concerning Lopez' Concealed Carry Weapons Permit that the I-Team has learned he obtained in 2016...two years after those gun threats against several people.
To obtain the Concealed Carry Permit, Lopez should have been subjected to a deep and thorough background check.
Also prior to obtaining that permit, Lopez was expelled from the Chicago Fire Department training program for aggressive and improper conduct toward women including shoving several female cadets.
RELATED: Slain Dr. Tamara O'Neal was 'simply the best,' colleague says
While state police investigators attempt to piece together the circumstances surrounding Lopez' licensing, it may be that he escaped disqualification because no criminal charges were filed in connection with the incidents. It is not clear whether state officials knew about any of the threatening behavior until this week's burst of violence at the South Side Chicago hospital.
Regardless of whether the system failed, regulators missed red flags or Lopez simply managed to hide his penchant for violence, when he ambushed his recently ex-fiancé Dr. Tamara O'Neal he had a legal 9mm Glock tucked into the waist band of his pants.
Chicago police investigators say that he had purchased that gun in 2012 at Shore Galleries in north suburban Lincolnwood. It was a legal purchase they said, as Lopez was in possession of a valid Illinois Firearm Owners Identification card at the time.
A phone message was left by the I-Team at Shore Galleries concerning the purchase, but Wednesday afternoon it had not been returned. Shore Galleries also advertises Conceal Carry License classes that consist of "interactive class room instruction and discussion on all the topics mandated by the Illinois State Police (ISP)." It is not known where that is where Lopez took CCL classes to obtain his concealed weapons permit.
Investigators from the U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives provided Chicago police with the gun trace information. CPD spokesman Anthony Guglielmi said that Lopez bought the pistol used at Mercy Hospital and at least three other guns in the past five years.
Mercy Hospital Chicago Shooting: Illinois State Police investigating Mercy Hospital shooter's gun permits