Updated

A man fired more than 100 rounds at sheriff's deputies in Colorado early Sunday, killing one and injuring four others, before being fatally shot himself in what authorities called an ambush. Two civilians were also injured.

Douglas County Sheriff Tony Spurlock said deputies came under fire almost immediately and were shot "very, very quickly" after entering a suburban Denver 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."

The Douglas County coroner identified the suspect as 37-year-old Matthew Riehl.

A YouTube user named Matthew Riehl posted a YouTube video Dec. 13, saying he wanted to replace Spurlock and railing against the sheriff and other officers in profane, highly personal terms.

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.

The incident began around 5:15 a.m. at Copper Canyon Apartments, a landscaped apartment complex in Highland Ranch, 16 miles (28 kilometers) 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.

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.

Vira Cover, who lives in a building about 50 yards away from the shooting, was woken up by a phone call from her fiance, 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. She sat on the couch with her cats and called Silknitter back before turning on the television to try to find out more about what was happening.

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

Silknitter heard the shots fired too but from about a half mile away, stopped at a police roadblock as he tried to get back home from work. Then he said he saw police in tactical gear speed past him in a pickup truck.

Silknitter said he lived 2 miles away from the movie theater in Aurora, Colorado 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.

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."

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."

A video posted on Nov. 28 shows a traffic stop by a police officer in the city of Lone Tree — apparently taken inside the officer's car — that Riehl said was done illegally. He alleges the officer clocked the wrong driver, identifying the officer by name in the video and calling him "dirty."

"Scumbag, dirtbag, liar," he says as the officer questions the driver. "He's the boss, huh? He's the Nazi in charge with the stripes on his shoulder and the fake badge."

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.

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

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; and Castle Rock police officer Tom O'Donnell, 41.

The two civilian injuries were not life-threatening.

Pelle is the son of Boulder County Sheriff Joe Pelle. The sheriff shared a picture of him and two other family members by his son's hospital bed on his office Twitter account. All four, including Jeffrey Pelle, who underwent surgery, are smiling and giving a thumbs-up gesture.

President Donald Trump expressed sorrow, writing on Twitter, "My deepest condolences to the victims of the terrible shooting in Douglas County @dcsheriff, and their families. We love our police and law enforcement - God Bless them all!"

The shooting occurred on the final day of a year that saw the deadliest mass shooting in modern U.S. history in Las Vegas.

__

Associated Press writers Sadie Gurman in Washington, Terry Tang in Phoenix and photographer David Zalubowski in Denver contributed to this report. Spagat reported from San Diego.