(NBC News) - A suspect was captured Wednesday morning in the "ambush-style attacks" of two Des Moines-area police officers slain while sitting in their cars, Iowa authorities said.

Police arrested Scott Michael Greene, 46, in nearby Dallas County amid a manhunt several hours after the early-morning shootings, Des Moines police Lt. Chris Scott told NBC News. He was being transported back to Des Moines for questioning.

A law enforcement official told NBC News the suspect has "a history of problems and mental issues and was in dire straits."

Earlier, police described Greene as armed and dangerous, and said he posed a "clear and present danger to police officers."

Greene, of the Des Moines suburb of Urbandale, was arrested at least two other times for misdemeanors ending in probations in 1992 and 2015, state records show.

Sgt. Paul Parizek, a Des Moines police spokesman, said this latest incident happened without warning. There did "not appear that there was any interaction between these officers and the coward who shot them," he told reporters.

Parizek, who said the officers "were gunned down when they were sitting in their car," added that his colleagues were travelling in pairs for their own safety.

The victims' names were not immediately released.

"These were our friends. They were our co-workers," said Parizek, adding, "We're heartbroken."

In an earlier statement, the Des Moines Police Department said the first officer was found dead at around 1:06 a.m. CT (2:06 a.m. ET) in Urbandale, which also has its own force.

A second officer's body was located in Des Moines at 1:26 a.m. CT (2:26 a.m. ET), it added. The officer died shortly after being taken to hospital.

"The shootings appear to have been ambush-style attacks," the statement said.

It added that "suspect information is being developed at this time."

The Urbandale shooting took place near Urbandale High School, and the school district announced Wednesday it was canceling classes.

The local community was already mourning the loss of two other Des Moines officers who died in a car crash while on duty on March 26.

"I don't even know where to begin, how bad this year is," Parizek added.

He also referred to tensions across the country and that some people have "not-so-positive views of law enforcement."

The July 7 sniper killing of five officers in Dallas during a peaceful protest highlighted the deadly danger many officers face at work on a daily basis.

"An attack on public safety officers is an attack on the public safety of all Iowans," Gov. Terry Branstad and Lt. Gov. Kim Reynolds said in a statement. "We call on Iowans to support our law enforcement officials in bringing this suspect to justice."

Attorney General Loretta Lynch said the Justice Department will assist in the investigation into the attacks, and cautioned others against ratcheting up "tension and mistrust" between law enforcement and communities.

"I know that while we do not yet know what led the perpetrator to commit these awful crimes, many will be nevertheless be tempted to read a message or motive into this assault," she said. "But let me be clear: there is no message in murder. Violence creates nothing; it only destroys."