The gunman who killed a Douglas County deputy and wounded four law enforcement officers Sunday ambushed them after they responded to a domestic disturbance call at a Highlands Ranch apartment complex, Sheriff Tony Spurlock said.

“He knew we were coming,” Spurlock said. He said the gunman used a rifle and fired at least 100 rounds. The gunman, identified as a 37-year-old former soldier and lawyer, was killed in a shootout with officers.

Four deputies arrived together at the gunman’s home in the Copper Canyon Apartments, a collection of two-story brick buildings near County Line Road. After the officers entered the suspect’s apartment, he barricaded himself inside a bedroom and then unleashed a volley of gunfire. All the officers were wearing bulletproof vests but were struck in unprotected parts of their bodies.

“They all went down, almost within seconds of each other,” Spurlock said at a news conference. The wounded deputies crawled away while others responded. Deputy Zackari Parrish, 29, was identified as the slain officer. Spurlock said Parrish was shot several times.

“When (Parrish) was shot, and went down, the other officers went down right around him,” Spurlock said. “They tried to pull him out but were unable to due to their injuries.

“I do know all of them were shot very, very quickly, and they all went down almost within seconds of each other. So it was more of an ambush type of attack on our officers. He knew we were coming, and we obviously let him know we were there to investigate the disturbance.”

Spurlock said Parrish is survived by a wife and two young daughters. Parrish had been a deputy for about seven months.

“They had many hopes and dreams and he was doing his job, and he was doing his job well, and his life was taken from us this morning,” Spurlock said. He added: “We are deeply saddened by the loss of Zackari. When I sat with his wife and held her hand, I could see in her eyes, her life is over. … It was very difficult today to go see Zack the last time.”

The injured deputies are Michael Doyle, 28; Taylor Davis, 30; and Jeff Pelle, 32. Castle Rock police officer Thomas O’Donnell, 41, was also wounded. All were listed as stable at hospitals.

Two people in adjacent apartments were wounded, but their injuries were not life-threatening, Spurlock said.

“Our hearts and prayers go out to them as well, as just regular people trying to live their life, disrupted by this individual,” Spurlock said.

Spurlock said the gunman had no apparent criminal history, but he was well known to law enforcement. Spurlock declined to provide further details. The sheriff’s office identified the gunman as Matthew Riehl, an Iraq war veteran who has posted a number of anti-law-enforcement videos on YouTube. Riehl at one time worked as a lawyer in Rawlins, Wyo.

Parrish’s body was moved from Littleton Adventist Hospital in a black hearse, accompanied by dozens of law enforcement vehicles and motorcycles as it drove south on Broadway toward C-470. Firefighters stood, saluting, on their trucks along the procession route, and some residents stood on street corners with American flags.

A gofundme page for Parrish’s family was set up, but the sheriff’s office urged people to send donations to the Douglas County Fallen Officer Fund instead.

Parrish’s neighbors in Highlands Ranch tied blue ribbons to trees in support of the fallen officer. A nearby Michaels crafts store quickly sold out of wide blue ribbon.

The law enforcement procession is heading south on Broadway from Littleton hospital. pic.twitter.com/SMKwvg2KEq — Larry Ryckman ☀️ (@larryryckman) December 31, 2017

Boulder County Sheriff Joe Pelle’s son, Jeff, was among the wounded deputies, according to the sheriff’s Facebook page.

Three of the wounded were taken to Sky Ridge Medical Center in Lone Tree, and four were taken to Littleton Adventist Hospital. Deputies closed down a stretch of County Line Road between University Boulevard and Colorado Boulevard for hours while the incident unfolded.

Later on Sunday afternoon, investigators searched two vehicles: a Ford Mustang LX and a four-door, maroon Chevrolet sedan. The plate on the Mustang said “Veteran of Iraq War.”

Deputies were called to the apartment in the 3400 block of County Line Road near Colorado Boulevard at 3 a.m. on a report of a verbal disturbance between two males.

“One male said the suspect was acting bizarre and might be having a mental breakdown,” the sheriff’s office said in a news release. Deputies cleared the scene at 3:40 a.m. and left because no crime had been committed.

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

They were called back to the scene at 5:14 a.m., and all four officers were there by 5:35 a.m., the release said. Riehl’s roommate then gave deputies a key and permission to enter the apartment, but the man left before the gunman opened fire from a bedroom at 5:56 a.m.

SWAT team members entered the apartment at 7:30 a.m. and exchanged gunfire with the suspect, the release said. The gunman was killed, and officer O’Donnell was wounded by the suspect. Riehl’s roommate was not injured and has been cooperating with investigators, Spurlock said.

Spurlock said investigators will examine officers’ body cameras to piece together details of the incident, with Douglas County detectives working around the clock along with Arapahoe County and the 18th Judicial District.

“This is going to be a several-day investigation, as you can imagine,” Spurlock said. “So I ask the community to have patience with us.”

The sheriff noted that although he didn’t know whether the deputies arriving at the call had any specific knowledge about the possibility of guns at this residence, they always know it’s a strong possibility.

“We respond to every call, anticipating that everyone has a gun,” Spurlock said. “This is Colorado. Everybody has a gun. We anticipate that when we respond to them that people have guns, and we address that in that fashion.”

He added that once a suspect barricades himself, “you can almost always assume that there’s a gun there. The situation went very quickly once the officers could no longer negotiate with him.”

Steven Silknitter, 50, lives in the Copper Canyon Apartments complex but was working elsewhere overnight when he heard about the shooting from his son. He called home, waking up his fiancee, Vira Cover.

A few minutes later, Cover said, she heard about 20 shots in rapid succession.

“It was surreal,” said Cover, 50.

She had been listening to the news and knew that authorities were warning residents to stay inside and avoid windows and exterior walls.

“My cats were scared so I took them and cuddled up on the sofa,” she said.

Silknitter arrived at the scene, and he said he heard 15 to 20 shots from about a quarter-mile away.

“It was back and forth — unbelievable,” said Silknitter, who lived in Aurora during the 2012 theater shooting. “Where do you move to?” he said, shaking his head in exasperation. “It’s everywhere.”

Staff reporters John Ingold, David Migoya and Mark K. Matthews contributed to this report.

Procession for the deceased officer will take place soon from @LittletonHosp. Expect heavy law enforcement presence and traffic congestion on Broadway, C470 and SB I-25 #CopperCanyonOIS — DC Sheriff (@dcsheriff) December 31, 2017

“She was pretty scared. She kept saying how loud it was.” Silknitter said. — Larry Ryckman ☀️ (@larryryckman) December 31, 2017

Multiple law enforcement vehicles, Douglas County Sheriff, South Metro and Littleton fire rescue vehicles coming and going from the scene. — Larry Ryckman ☀️ (@larryryckman) December 31, 2017

**Copper Canyon OIS Update**- Deputies responded to a domestic disturbance resulting in shots fired. 5 deputies shot by suspect. 1 deputy confirmed deceased. 2 civilians also shot by suspect. Suspect shot & believed to be dead & no longer a threat. #CopperCanyonOIS — DC Sheriff (@dcsheriff) December 31, 2017

Due to the size and cope of this investigation an emergency shelter has been set up @ East Ridge Rec Center, located at 9568 University Blvd. in Highlands Ranch. If anyone has been displaced from their homes due to this event please feel free to head there. — DC Sheriff (@dcsheriff) December 31, 2017

UPDATE 0513 this morning deputies responded to he Copper Canyon Apartments for a Domestic Disturbance. During the Investigation, shots were fired and multiple deputies were injured. No status on the deputies and no status on civilian injuries. Please avoid this area. — DC Sheriff (@dcsheriff) December 31, 2017

Due to this incident, the following agencies are on accident alert. Douglas County, Parker Police Department, Lone Tree Police Department, Castle Rock Police Department and Colorado State Patrol. — DC Sheriff (@dcsheriff) December 31, 2017

#Breaking: we just heard gunshots in the distance. Police are now closing Colorado at otero. We are moving to the media staging area. @DenverChannel pic.twitter.com/7sZi7LjBiP — Meghan Lopez (@Meghan_Lopez) December 31, 2017

A Code Red was sent out regarding this incident. Any citizens in the affected area are instructed to shelter in place, avoid windows and stay away from exterior walls. pic.twitter.com/RgutCEqgJA — DC Sheriff (@dcsheriff) December 31, 2017

DCSO is working an officer down call in the area of County Line Rd between Colorado Blvd and University Blvd. This is an active event, please avoid the area. — DC Sheriff (@dcsheriff) December 31, 2017