(CNN) Just weeks before a barricaded man shot and killed a sheriff's deputy in a Colorado apartment, he apparently was writing alarming messages in email and on social media that included threats to police officers, officials have said.
Matthew Riehl, a 37-year-old former Army reservist, shot four sheriff's deputies who responded to a complaint at his apartment in the Denver suburb of Highlands Ranch on Sunday morning, killing one, police say. Riehl was killed during a subsequent shootout with a police tactical team -- a clash that also left a SWAT officer injured, authorities say.
The slain deputy was Zackari Parrish, a 29-year-old father of two. Two civilians outside the apartment also were shot and injured during the incidents, police say.
Police haven't revealed suspected motives for Sunday's shootings, but several law enforcement agencies had been aware weeks beforehand that Riehl was accused of writing harassing or suspicious messages online, officials said this week.
That includes "harassing posts" that Riehl put on his social media sites in November about a traffic stop in the Denver suburb of Lone Tree, just a few miles east of his apartment in Highlands Ranch, said Lone Tree spokeswoman Denisse Coffman.
Shortly after those posts, Riehl allegedly sent harassing emails to Lone Tree police officers, Coffman said.
"At that point, the Lone Tree Police Department immediately contacted the Douglas County Sheriff's Office to investigate, given that a Lone Tree police officer was being targeted by the suspect's harassing communication," Coffman said.
Coffman said she couldn't reveal any other information about the case because the investigation wasn't finished. But these apparently weren't the only messages that recently were brought to the attention of authorities.
In late 2017, the University of Wyoming -- where Riehl was a 2010 law school graduate -- alerted students and faculty to what it called his suspicious behavior.
According to a letter sent to faculty and staff in November, Riehl posted "rambling, nonsensical messages on his Facebook page" that mentioned the school. Campus police and the Laramie Police Department were both alerted to the posts. The faculty was asked to alert authorities if Riehl was spotted on campus.
Chad Baldwin, associate vice president for communications and marketing at the university, told CNN the posts were "outrageous, vulgar and alarming." Baldwin said the university heightened security on campus, but there were no reported sightings of Riehl in the area.
Douglas County Sheriff Tony Spurlock told reporters Sunday that Riehl had previous contacts with law enforcement "throughout the metro area," but had no criminal history.
Sunday's shootings began after 5:30 a.m. at the Copper Canyon Apartments in Highlands Ranch, about 20 miles south of Denver.
It was the second time deputies had gone to the apartment Sunday. There was a noise complaint call at around 3 a.m., but when deputies got there, there was no noise. After they spoke with a roommate in the apartment, they left, the Douglas County sheriff's office said.
"One male said the suspect was acting bizarre and might be having a mental breakdown," a police news release said.
The second call was dispatched as a domestic disturbance, and by 5:35 a.m. the four deputies had arrived at the scene.
The sheriff's office said the roommate returned to the scene, gave deputies a key and said they could enter the residence. The roommate then left, police said.
Not long after the deputies found the suspect barricaded in his room, Riehl opened fire, Spurlock said.
"There were well over 100 rounds fired," Spurlock said, adding that the deputies "all went down within almost seconds of each other, so it was more of an ambush type of attack on our officers."
The wounded deputies crawled to safety as other law enforcement agencies responded to the shots fired call.
Riehl was killed about 90 minutes later during a shootout when a tactical team went into the apartment, the sheriff's office said.
Parrish, the slain deputy, was a "good kid" who was "eager to work, eager to serve," Spurlock said Sunday.
"This is a tragic day that we will be feeling for a long time," the sheriff added.
A memorial service for the fallen officer was held at a church in Littleton Monday, where Parrish's wife spoke to those who attended.
President Donald Trump tweeted his "deepest condolences to the victims of the terrible shooting in Douglas County ... and their families."
Riehl served with the Wyoming National Guard from 2006 to 2012, according to Deidre Forster with the Wyoming National Guard's office of public affairs.
Forster told CNN that Riehl enlisted in the Army Reserve in 2003. He spent time in Iraq in 2009 as part of a security mission during a one-year deployment with the 300th Field Artillery Regiment, according to Forster. He was honorably discharged in 2012 as an E-4 (specialist), Forster said.
In July, Riehl attended an eight-hour firearms course in Colorado Springs taught by Kenaz Tactical Group, the company said. Riehl's "demeanor during the training sessions was not alarming," company owner Robert Butler said in statement.