Authorities in suburban Denver were investigating on Monday what led a 37-year-old man to fire more than 100 rounds in his apartment on sheriff's deputies the previous day, killing one and injuring four others.

The Douglas County coroner identified the suspect, who was eventually killed at the scene, as Matthew Riehl.

A YouTube user named Matthew Riehl posted a video Dec. 13, saying he wanted to replace Douglas County Sheriff Tony Spurlock and railing against the sheriff and other officers in profane, highly personal terms. In the video, Riehl identifies himself as a former Iraq War veteran.

The incident began around 5:15 a.m. Sunday at Copper Canyon Apartments, a landscaped apartment complex in Highlands Ranch, 28 kilometres south of Denver.

Authorities had left the home barely an hour earlier in response to a complaint of a "verbal disturbance" involving two men, the sheriff's office said. One of the men told them the suspect "was acting bizarre and might be having a mental breakdown" but the deputies found no evidence of a crime.

When deputies were called back, a man who had left came by to give them a key and granted permission to enter the home, leaving again before shots were fired.

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

Spurlock said deputies came under fire almost immediately and were shot "very, very quickly" after entering the apartment and trying to talk with the suspect, who was holed up inside a bedroom.

"They all went down almost within seconds of each other, so it was more of an ambush-type of attack on our officers," Spurlock said. "He knew we were coming and we obviously let him know that we were there."

Douglas County Coroner confirms shooting suspect in <a href="https://twitter.com/hashtag/CopperCanyonOIS?src=hash&ref_src=twsrc%5Etfw">#CopperCanyonOIS</a> as Matthew Riehl DOB 9/09/80 (pictured). Investigation still ongoing and being investigated by <a href="https://twitter.com/DA18th?ref_src=twsrc%5Etfw">@DA18th</a> Critical Response Team. <a href="https://t.co/H6wT0klSQv">pic.twitter.com/H6wT0klSQv</a> —@dcsheriff

The wounded deputies tried to pull the fallen officer, Zackari Parrish, out of the line of further gunfire, but were unable to because of their own injuries and only managed to "crawl to safety," Spurlock said.

Four officers, including Parrish, were shot from a bedroom around 6 a.m., forcing the retreat. A SWAT team entered the apartment at about 7:30 a.m. in an exchange of gunfire that left the gunman dead and another officer injured.

Two civilians were also injured.

Vira Cover, who lives in a building about 45 metres away from the shooting, was woken up by a phone call from her fiancé, Steve Silknitter, who warned her about what was happening and urged her to stay inside. Soon afterward, she said she heard about 15 to 20 very loud shots fired over about 30 seconds or a minute.

"I couldn't believe this was happening in our backyard," she said.

Silknitter said he lived a few kilometres away from the movie theatre in Aurora, Colo., where 12 people were killed in a shooting in 2012. He said he never would have expected anything like this in his apartment complex, where the only noise you might normally hear is children running around upstairs.

"Where do I move to where I don't have to worry about someone shooting us?" asked Silknitter, who is now considering getting a concealed weapons permit.

'This is Colorado. Everybody has a gun.'

The suspect was well known to authorities in the Denver area but had no criminal record, said Spurlock, who declined to name him until his identity was confirmed.

Riehl said in his Dec. 13 YouTube video, called "Fire Sheriff Spurlock," that he would run as a libertarian, ending with holiday greetings and a vow to "fire all these bums come early next year."

This undated photo provided by the Douglas County Sheriff's Office shows Sheriff's Deputy Zackari Parrish, who was fatally wounded when a man fired dozens of rounds at the deputies in Denver. (Douglas County Sheriff's Office via AP)

Riehl is vague about his political beliefs and personal grievances, though his animosity clearly ran deep. He flashes the business card of an officer who, he says, shows up at homes after sunset with an attractive woman and "will then ambush you from behind the door."

According to the Denver Post, Riehl previously practised law in Wyoming but let his licence lapse in 2016.

The sheriff did not release any details about the weapons and ammunition used except to say the suspect had a rifle. He also did not know if law enforcement had any prior knowledge of firearms being in the home but the possibility always weighs on deputies' minds.

"We respond to every call anticipating that everyone has a gun. This is Colorado. Everybody has a gun," Spurlock said.

Parrish, the slain officer, was 29 and a married father of two young children. He came to the department seven months ago after working as an officer for the nearby Castle Rock Police Department. 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," the sheriff said.

A procession of police vehicles escorts the hearse carrying the body of the deputy killed on Sunday. (Rick Wilking/Reuters)

Gov. John Hickenlooper ordered flags on all public buildings immediately lowered to half-staff until Tuesday evening in Parrish's honour.

The three deputies and one police officer injured were listed in stable condition. Authorities identified them as deputies:

Michael Doyle, 28.

Taylor Davis, 30.

Jeffrey Pelle, 32.

Tom O'Donnell, 41, a Castle Rock police officer.

The two civilian injuries were not life-threatening.