Getting your Trinity Audio player ready...

Daniel Aguirre became increasingly paranoid after losing his job as a forklift operator, prosecutors said. He had stopped sleeping, installed padlocks on the doors of his apartment and was drinking eight to ten energy drinks per day.

On Monday, a fight with his longtime partner turned into an hourslong standoff that left both a woman and a SWAT officer injured, with Aguirre facing nearly a dozen felony charges.

Police and Cook County state’s attorney’s office records show Aguirre, 42, was charged with three counts of attempted murder, two counts of aggravated discharge of a firearm toward a police officer and other charges.

He appeared in Cook County court Wednesday where a judge ordered him detained while awaiting trial, after prosecutors alleged how domestic violence led to a close call for a Chicago cop.

Aguirre shot a 67-year-old woman at a home in the 4600 block of North Springfield Avenue before barricading himself inside with another woman and a 14-year-old girl, authorities said.

Aguirre lives at that address in a second-floor apartment with his longtime partner and their 14-year-old daughter, according to a proffer presented Wednesday by Cook County prosecutors. The partner’s mother and sister also live in the building.

Aguirre had accused his partner of poisoning him before beginning his “reign of terror” on Monday morning, Assistant State’s Attorney Mike Pekara said at the detention hearing. During the ensuing argument, Aguirre’s partner told him to give her his keys and leave the apartment by the time she returned from work, prosecutors said.

After handing over his keys, Aguirre became physically violent, prosecutors said. He blocked his daughter from fleeing the apartment, attempting to stomp on her head after she fell to the floor, Pekara said.

The partner’s mother, 67, heard the commotion and, along with the partner’s sister, climbed up the rear stairwell to knock on the door, prosecutors said. Aguirre shot through the door, striking the partner’s mother in the face.

Aguirre then turned on the stove’s burners and began pacing the apartment, Pekara said. The partner called 911 and set her phone aside. In the kitchen, Aguirre struck her with the butt of a knife, Pekara said, telling her he had eight bullets left — enough to kill her, their daughter and himself, along with “five of them.”

When officers arrived, they found the partner’s mother critically wounded. They administered lifesaving measures at the scene while waiting for an ambulance to arrive, interim CPD Superintendent Fred Waller said Monday afternoon outside Advocate Illinois Masonic Medical Center. She is now in stable condition, prosecutors said.

Responding officers called for a SWAT team, which tried to breach the door of the residence. Aguirre opened fire through the door and struck one of the officers in the abdomen.

Hostage negotiators persuaded Aguirre to release his daughter, who was taken to the hospital with visible bruising and scratches. They later convinced him to step outside with his partner.

The woman and teen were “battered” and were taken to Stroger Hospital for non-life-threatening injuries, Waller said.

A search of the apartment yielded two magazines — one empty and one loaded— and 18 empty shell casings. A .38-caliber handgun was also recovered. There were nine bullet holes in the door and nine on a wall in the kitchen.

The wounded officer, equipped with a bulletproof vest, was transported to Illinois Masonic, where he was immediately taken to surgery. Waller said the officer was expected to make a full recovery and was being visited by family. The officer has been with CPD for about 20 years, and with the SWAT team for at least 12, Waller said.

“It is unfortunate that domestic violence exists in the way that it does in this city,” Mayor Brandon Johnson said at the conference. “But we are grateful that our police department, as well as our SWAT team in particular, were able to de-escalate the situation.”

According to prosecutors, Aguirre was arrested for domestic battery in 2004 and again in 2008, but both cases were dismissed.

Aguirre is due back in court on Aug. 12.