Inside a cramped, cluttered apartment before sunup on New Year’s Eve, chaos unfolded in a matter of seconds – a burst of gunfire, two sheriff’s deputies hit, three others scrambling out of the line of fire.

Douglas County sheriff’s deputy Zackari Parrish, hit by multiple rounds fired from behind a bedroom door by a 37-year-old man with a history of both mental health issues and conflicts with cops, lay on a hallway floor badly wounded, shouting that he’d been hit. Deputy Taylor Davis – suffering from three gunshot wounds to the left forearm, one to the left thigh and one to the left shoulder – busted out a second-floor window and jumped to the ground.

Within seconds, deputies Mike Doyle and Jeff Pelle, who had briefly retreated in the face of gunfire, went back into the apartment to try to rescue Parrish.

RELATED | Officers justified in killing man who fatally shot Douglas County Deputy Zack Parrish

The gunman opened fire again, hitting them both and forcing them to flee without Parrish.

And then Matthew Riehl, who deputies planned to take into custody for a mental health hold, stepped from his bedroom and shot Parrish twice more. One of those bullets hit the deputy in the face – but Douglas County Sheriff Tony Spurlock said he believes based on his conversations with the pathologist who examined Parrish's body, he'd already suffered wounds that result in his death.

Those chilling details are spelled out in detailed terms in a 106-page report of the incident made public Monday afternoon by the Douglas County Sheriff’s Office. That report was released shortly after the District Attorney’s Office for the 18th District released its findings that all of the law officers involved in the protracted gun-battle at the Copper Canyon Apartments were legally justified in using deadly force.

RELATED | Profanity-laced live stream from ambush shooter shows rambling call to 911

dougco shooting (2)_1531790417845.jpg.jpg
Douglas County Sheriff's Office

Much of what was spelled out in the report and the letter was not new – previously released footage from body cameras of officers at the scene, including some who were injured, told the story in horrifying details.

What was new were minute details about what occurred after Riehl, a troubled former attorney, first called 911 from his apartment at 3404 E. County Line Road. That was shortly before 3 a.m. on the last day of 2017, and Riehl reported a disturbance.

503742553_750x422_1531765491107.jpg

Riehl was already in the sheriff’s department’s system as a “hazard” – a message sent to deputies called it a “minimum 2 car response,” and said Riehl is a “veteran suffering from PTSD” who “has access to weapons” and “is hostile towards law enforcement.”

RELATED | 'Red flags' on ambush shooter caused Wyoming police to reach out to Colorado authorities

Parrish and other deputies responded concluded that the beef Riehl was having with his roommate wasn’t a crime, and though they suspected he was having mental health issues they concluded there wasn’t justification to take him into custody for an evaluation.

dougco shooting (3)_1531790420802.jpg.jpg
Douglas County Sheriff's Office

At 5:12 a.m., Riehl called 911 again.

According to the report, when the first deputies arrived they realized that Riehl had thrown belongings off his apartment balcony into the courtyard below, and after talking with deputies briefly in a bizarre exchange at his door the man retreated into his unit. In the meantime, the deputies retreated to an area outside the apartment, and all of them muted the microphones on their body cameras while they discussed their next steps.

According to the report, during that time Parrish called Riehl’s roommate, who was at work, and that man gave the officers permission to enter the apartment and said he would respond with a key.

Once he did, the deputies decided to enter the apartment. The plan, according to the report, was to take him into custody so he could be evaluated at a mental health facility.

Parrish told other officers he believed Riehl was having a “manic” episode – deputy Pelle would recall his fallen colleague as having described it as the worst he had seen.

"The second call, he clearly met the statute of imminent danger to himself or others for a number of reasons based upon what the officers were assessing at that moment ... because that’s what we have to talk about is the [imminent] danger, throwing things off his balcony, screaming, hollering, yelling, not being coherent with the officers," Spurlock said, "all of those things put together in their totality led the officers to believe collectively that he was an [imminent] danger to himself or others, others were in danger of him and that a mental health hold was appropriate to take him in."

dougco shooting (6)_1514738923251.jpg.jpg
SKY9

At 5:53 a.m., deputies went back to the door of Riehl’s unit, opening it with the key supplied by the roommate. After moving clutter apparently left as a barricade, the deputies approached Riehl’s bedroom door. He shouted from behind it “help me now” and “go away … don’t come in … I warned you,” according to the report.

After deputy Davis and Parrish tried kicking in Riehl’s door, he opened fire.

In a matter of 20 seconds, Riehl, Davis, Doyle and Pelle – and two neighbors – were injured.

Over the next 90 minutes, according to the report, officers formulated plans to try to rescue Parrish and take Riehl into custody, and it details his bizarre yells – “Oh God. Oh God. Ahhhh, help me God please. I didn’t do anything.” And, “Why, why, leave me alone unless you have a warrant. You don’t have a warrant.” And, “where is your warrant? Not on the dead pig.”

At 7:29 a.m., members of a SWAT team burst into Riehl’s apartment in a final fusillade of gunfire, pulling Parrish out of the apartment, and shooting the gunman before busting through his bedroom door and handcuffing him while he was still alive and struggling.

dougco shooting (1)_1531790417800.jpg.jpg
Douglas County Sheriff's Office

In that final confrontation, Castle Rock police officer Thomas O’Donnell suffered a gunshot wound to the leg.

Riehl suffered four gunshot wounds, two of which hit vital organs. He died at the scene.

"I stand by my deputies 100 percent," Spurlock said. "I think they did exactly what they were trained to do. Exactly how they would respond to any kind of mental health call and given the total circumstances with this individual, I think that they took extra precautions. That’s why there were four officers there and a supervisor, normally we go to these types of calls with much less resource."

Spurlock said following this incident, every deputy on a shift now has access to a ballistic shield that can withstand a high caliber round. Parrish was also shot with .223 rounds that went through his body armor, so his department is in the process of getting new vests for its deputies that could withstand that.

The sheriff says the vests are being made. He expected his deputies to have those before the end of the year.

George Brauchler, the 18th Judicial District attorney, said he believes Riehl's behavior put the deputies who responded to his apartment in a place where "inaction was not an option."

"I don’t think they could have just said, 'well, lets just go home and cross our fingers and hope he doesn’t go apartment to apartment or go do something out on the street or even to himself,'" Brauchler said. "I think at that point they had met the threshold that they needed to try to intervene."

9NEWS reporter Anastasiya Bolton contributed to this report.

Contact 9NEWS reporter Kevin Vaughan with tips about this or any story: kevin.vaughan@9news.com or 303-871-1862.