A 19-year-old man admitted to shooting a Fort Lupton police sergeant at least three times with a handgun during a gunfight in Colorado on Monday, thus critically injuring him, according to a newly released affidavit by Greeley Police Department.

Officers with the Fort Lupton Police received a call Monday about the presence of an armed person in the 200 block of Ponderosa Place. They reached the place at around 10:40 p.m. EST and found an armed Matthew Cotter, as identified in the court documents, trying to contact his ex-girlfriend inside a home, Judicial Critical Incident Response Team (CIRT) said in a press release earlier.

When police approached the residence, Cotter took a handgun from a vehicle and opened fire at the police by hiding behind a fence. Officer Christopher Pelton ended up with serious injuries after receiving three gunshots. Other officers returned fire and left Cotter significantly injured before taking him into custody, according to CIRT.

Pelton had a shattered jaw and lost teeth as a result of the gunshots and remains in critical condition at Swedish Medical Center in Denver after undergoing two surgeries.

Cotter, who had also undergone two surgeries since the shooting and declared stable at the Medical Center of the Rockies, was booked under the charges of attempted murder, assault with a deadly weapon and threatening a peace officer with a weapon.

"I shot, he dropped. They shot, I dropped," Cotter was quoted in the affidavit.

Cotter’s ex-girlfriend’s mother alerted officers around 8:42 p.m. EST that Cotter had called her and threatened to commit suicide in front of the family’s home. Police arrived at the spot but failed to locate Cotter, according to the affidavit. The girl’s father called the cops after some time and told them that Cotter had pulled up nearby with his car’s lights off, texting their daughter. “It’s too late,” the text read, according to the affidavit.

shooting
In this image, a police car is seen behind police tape blocking a street leading to the Jacksonville Landing area in downtown Jacksonville, Florida, Aug. 26, 2018. GIANRIGO MARLETTA/AFP/Getty Images