This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

HIGHLANDS RANCH, Colo. — A gunman shot and killed a deputy, and wounded three other deputies, a police officer and two civilians at an apartment complex in an ambush-type of attack early Sunday morning, the Douglas County Sheriff’s Office said.

About 5:15 a.m., deputies responded for the second time in two hours to the Copper Canyon Apartments complex at 3404 E. County Line Road in Highlands Ranch, between Colorado and University boulevards.

A man had left the apartment before deputies arrived, but returned, and gave a key and permission to enter the unit, the sheriff’s office said.

About 5:55 a.m., four deputies were hit by rifle rounds from the suspect’s bedroom, the sheriff’s office said.

Three of the deputies managed to get to safety, but a fourth, 29-year-old Zackari Parrish, was not able to get out of the line of fire.

Because of the large amount of gunfire and injuries they suffered, the other deputies weren’t able to rescue Parrish.

Parrish was shot multiple times and according to the attending doctor, wouldn’t have been able to survive his injuries because of where he was shot.

“I do know that all of them were shot very, very quickly. They all went down almost within seconds of each other, so it was more of an ambush-type of attack on our officers,” Douglas County Sheriff Tony Spurlock said.

“He knew we were coming and we obviously let him know that we were there.”

RELATED: Douglas County Sheriff fallen officer fund

A SWAT team was called out and entered the apartment about 7:30 a.m. Shots were exchanged, resulting in the death of the suspect, identified as 37-year-old Matthew Riehl.

SWAT officer Tom O’Donnell of the Castle Rock Police Department was shot and injured by the suspect.

Riehl fired more than 100 rounds in the attack, the sheriff’s office said.

Deputies Michael Doyle, 28, Taylor Davis, 30, and Jeffrey Pelle, 32, were injured. They and O’Donnell are are in stable condition.

The two civilian injuries were not life-threatening, the sheriff’s office said. Pelle is the son of Boulder County Sheriff Joe Pelle.

Injured Douglas County sheriff’s deputies Jeff Pelle, Taylor Davis and Michael Doyle, and Castle Rock Police Department SWAT officer Thomas O’Donnell.

Authorities had left the apartment about 3:45 a.m. to address a noise complaint but returned about 5:15 a.m. in response to reports of another disturbance.

Spurlock said the disturbance was initially reported to be domestic but turned out to be noise-related.

“The suspect was just making a ton of noise and annoying everyone around him,” Spurlock said.

Parrish, the slain officer, was a married father of two young children. He had been with the department for about seven months. Spurlock called him a “good kid” who was eager to work.

“His wife told me today that he loved this job more than he had loved any job he ever had,” Spurlock said.

Parrish previously worked for nearly 2 1/2 years with the Castle Rock Police Department.

“Our thoughts and prayers are with the Douglas County Sheriff’s Office and the family and friends of Deputy Parrish,” Gov. John Hickenlooper said in a statement. “We can only imagine the depth of grief they are experiencing.

“We also hope for a speedy recovery for the Douglas County deputies and the Castle Rock police officer injured in the incident, as well as the residents who also were affected.

“The call to protect and serve too often leads to this ultimate sacrifice. We are grateful for the service of Deputy Parrish, his fellow deputies, and that of the Castle Rock police officer. We pray for their and their families’ strength and resolve in the days and months ahead.”

Hickenlooper ordered flags be lowered in honor of Parrish.

The sheriff’s office issued a code red for any citizens in the affected area. They were instructed to shelter in place, avoid windows and stay away from exterior walls. It has since been lifted.