(CNN) A suspect in Wednesday morning's apparent ambush killings of two Iowa police officers was taken into custody hours later, after he flagged down a natural resources officer a county away from where the killings occurred, police said.

Investigators believe Scott Michael Greene, 46, shot Urbandale police Officer Justin Martin and Des Moines police Sgt. Anthony "Tony" Beminio while they sat in squad vehicles at intersections roughly 2 miles apart shortly after 1 a.m., authorities said.

Greene, of Urbandale, was taken into custody later that morning after he flagged down a state Department of Natural Resources officer while walking on a gravel road in Dallas County and asked him to call 911, police said.

Greene was not charged in the killings as of noon, but he is "suspected of doing this," Des Moines police Sgt. Paul Parizek said, citing unspecified tips and leads.

Urbandale police said they had interacted with Greene before, including about two weeks ago, when they told him to leave a high school football game.

But Parizek said there was nothing to immediately indicate that Martin or Beminio had any previous contact with him.

CNN Map

Nor did it appear the officers had much warning that someone was about to shoot them, Parizek said.

"On the surface right now ... it doesn't look like there was any interaction between these officers and whoever the coward is that shot them while they sat in their cars," Parizek said, holding back tears, before Greene was named a suspect.

Greene was taken to a hospital after complaining of an issue with an existing medical condition, and detectives are expected to interrogate him, Parizek said.

'These guys were ... doing nothing wrong'

Police discovered Martin's body about 1:05 a.m., after residents reported shots being fired. Martin's body was seated in his squad car, at an Urbandale intersection just northwest of Des Moines, Parizek said.

JUST WATCHED Slain officers identified in Iowa shootings Replay More Videos ... MUST WATCH Slain officers identified in Iowa shootings 01:17

Twenty minutes later, as officers responded to the Urbandale shooting, Beminio was found shot in his squad vehicle, at an intersection in Des Moines.

Beminio died at a hospital, Parizek said. He said both officers were on patrol. Neither was responding to a service call, and neither had radioed about a confrontation.

Gov. Branstad, @IALtGov have been briefed by @IowaDPS on early morning attack on 2 police officers - https://t.co/NO0CZlEnhR #iagov — Terry Branstad (@TerryBranstad) November 2, 2016

"In all appearances it looks ... that these officers were ambushed," Parizek said.

"These guys were gunned down sitting in their car, doing nothing wrong."

Investigators believe "over 15 and under 30" shots were fired at Martin alone, Urbandale police Chief Ross McCarty said.

Greene told to leave game after waving Confederate flag, police say

Urbandale police had asked Greene to leave a high school football game about two weeks ago, prompting him to complain that police were infringing on his rights, McCarty told reporters.

Greene was asked to leave after he waved a Confederate flag in front of "people of color" during the national anthem, and other people complained it was offensive, McCarty said.

Thank you to our community for the outpouring of support. We are beyond blessed to serve the community of Urbandale. pic.twitter.com/0qZxhhjJzx — Urbandale Police (@UrbandalePolice) November 2, 2016

"He said he was invoking his First Amendment rights, and we were trampling on them," McCarty said.

Greene left school property but used public sidewalks to "continue his demonstration," McCarty said.

Police warned Greene to "cease and desist," and he afterward was negotiating with the school about when he'd be permitted at the school, which his daughter attends, the chief said.

Greene is white, as were Martin and Beminio, police said.

Investigators don't know of a motive in Wednesday's shootings, Parizek said.

Tearful embrace as Des Moines area mourns again

The shootings bring renewed pain to a community that recently mourned the deaths of two other Des Moines police officers. They were killed in March when their vehicle was hit head-on by a driver going the wrong way, police said.

UPD is saddened to report that an Urbandale Officer was killed in the line of duty overnight. Updates will be posted as available. pic.twitter.com/oGTvaAfjxZ — Urbandale Police (@UrbandalePolice) November 2, 2016

As news of the shootings spread, a woman gave bottled water and other supplies to an Urbandale police officer who was standing along a street, and tearfully gave him a hug, video from CNN affiliate KCCI showed

"I want you to go home to your families, because I want my dad to come home to me and I want my friends to come home to me, and I'm sorry," she said.

'A great friend to a lot of us'

Parizek, the Des Moines police spokesman, choked up as he spoke of Beminio, an 11-year veteran of the force who once worked under Parizek's patrol.

Beminio, married with children, had been a school resource officer and a robbery homicide detective, and was recently promoted.

"A great friend to a lot of us," Parizek said.

Martin, 24, had just finished academy and field training this year, McCarty said.

"We had high expectations (for) his future, and it's tragic it's been cut short," the chief said.

The Urbandale Police Department, a force of about 50 officers, said it believes this is the first officer it has lost in the line of duty.

Highest number of officers shot dead since 2011

Wednesday's deaths bring to at least 52 the number of police officers fatally shot in the line of duty in the United States and Puerto Rico in 2016, according to the National Law Enforcement Officers Memorial Fund . That's the highest one-year total since 2011, when 73 were shot dead, the fund says.

They also come just months after two high-profile deadly surprise attacks against police officers in Texas and Louisiana.

On July 7, a gunman shot and killed five police officers in Dallas during a protest of controversial police shootings of black men in other states. The Dallas shooter, who police subsequently killed, said he was upset with the other shootings, police said.

On July 17, gunman Gavin Long shot six law officers, killing three , in Baton Rouge, Louisiana, police say. A SWAT officer subsequently shot and killed Long.

JUST WATCHED 2 cops killed in apparent ambush attacks Replay More Videos ... MUST WATCH 2 cops killed in apparent ambush attacks 01:28

Long apparently visited Dallas after the shootings there, posting a YouTube video July 10 in which he spoke of the protests, and a notion that victims of bullying need to resort to brute force.