Daniel P. Finney, Charly Haley and Doug Stanglin

USA TODAY Network

DES MOINES — The suspect captured in connection with the early-morning "ambush-style" killing of two police officers in the Des Moines metro area Wednesday was removed by police from a high school football stadium two weeks ago after he claimed his Confederate flag was stolen by other spectators, authorities said.

Police said it appeared both officers were taken by surprise in the Wednesday shootings and had no opportunity to defend themselves. One of the killings took place near the stadium where the mid-October confrontation took place between police and the 46-year-old suspect, identified as Scott Michael Greene.

In the initial shooting, Urbandale police Chief Ross McCarty said it appears that Greene allegedly fired 15 to 30 shots into the driver’s side of a patrol car, killing Urbandale Police Officer Justin Martin, 24.

“The puzzling thing about this is that (Officer Martin) didn’t have any idea or warning or fear that anything was wrong,” McCarty said. Martin appeared to be stopped in his vehicle. “We’re assuming (Greene) walked up on foot.”

About 20 minutes later, a second officer, Des Moines police Sgt. Anthony "Tony" Beminio, 38, was shot and killed about two miles away while responding to the first shooting.

The suspect, who is white, was captured without incident about eight hours after the shootings and some 35 miles west of the crime scenes.

President Obama issued a statement Wednesday evening regarding the incidents, which he referred to as "shameful acts of violence."

"Sergeant Anthony Beminio and Officer Justin Martin represented our best, most decent instincts as human beings – to serve our neighbors, to put ourselves in harm’s way for someone else," Obama said in the statement. "They knew the dangers of their job. They knew the risks. Yet they chose to dedicate themselves to those values anyway. So today, Michelle and I join Americans across our country in expressing our condolences and stand in solidarity with their grieving families, fellow officers, and the communities they served so honorably."

The president's statement continued, "All across the country, our police officers go to work each day not knowing whether they’ll come home at night. Their families live each day with the same fears. So as Americans, we owe them our respect and gratitude for their efforts to safeguard our families and our communities. And so as we once again mourn American police officers lost in the line of duty, we must also renew the call to match that same sense of service, that same devotion within our own lives and our own communities."

Greene was taken into custody by the Dallas County Sheriff's Department while walking along a rural road in Redfield. According to police, Greene flagged down a passing Department of Natural Resources officer, handed over his ID and told the officer to call police. No shots were fired and there was no struggle.

Greene was taken by ambulance to a Des Moines hospital after complaining about an apparent medicine-related issue.

Court records indicate Greene had previous encounters with Urbandale police officers.

In the Oct. 14 confrontation, Greene was removed from Urbandale High School's football stadium after he claimed other spectators stole his Confederate flag, authorities said. He apparently posted two videos related to the incident on YouTube.

In one, Greene says he was in the stands, holding a Confederate flag during the national anthem, and that several “African-American” people behind him stole it. Throughout the video, he tells officers he wants to report an assault and a theft. Officers tell him that people reported he was a disturbance.

“It was almost like a mugging. I had my property and I was holding it and they stole it from me,” he says in the video.

Greene is also seen confronting officers, questioning why he is being asked to leave the school’s property. Officers tell him that holding a Confederate flag is in violation of a school district code. A different 10-second video by Greene, uploaded Oct. 21, shows an image of himself with Confederate and U.S. flags.

Ambush-style killings of police up 167% this year

The fatal shootings Wednesday began around 1:06 a.m. CT, when police departments from both cities responded to reports of gunfire at the intersection of 70th Street and Aurora Avenue in Urbandale. The first officers arriving on the scene found Martin fatally wounded.

About 20 minutes later, Beminio was fatally wounded near an intersection two miles away while responding to reports of the first officer's shooting.

Both officers were gunned down in their patrol cars.

"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," Des Moines police spokesman Sgt. Paul Parizek said in an emotional briefing with reporters.

"In all appearances it looks ... that these officers were ambushed," he added.

In Washington, U.S. Attorney General Loretta Lynch condemned the killings, saying “violence has no place in the United States of America.’’

“Let me be clear, there is no message in murder,’’ the attorney general said, referring to simmering distrust between law enforcement and many communities across the country. “Violence creates nothing; it only destroys.’’

Within hours, police identified Greene as a suspect in the case, releasing his photographs along with information about the truck he was believed to be driving. Officials, however, were tight-lipped on how they singled him out early on as the suspect.

Greene had earlier run-ins with police prior to the stadium incident. In April 2014, according to court records, he was charged with a simple misdemeanor count of interference with official acts for resisting an attempt by officers to pat him down for weapons at an Urbandale residence. The officers wanted to search Greene after noticing he had a pouch on his belt that resembled a holster.

Greene was “noncompliant, hostile, combative and made furtive movements toward his pockets” before the arrest, Officer Chris Greenfield wrote in the complaint. Greene pleaded guilty to the charge about two weeks later.

The complaint does not indicate why officers initially came into contact with Greene. But two days later he reportedly threatened to kill a man in the parking lot of the same apartment complex and was charged with first-degree harassment, according to another complaint.

In that incident, Greene was accused of approaching a man in the parking lot and shining a flashlight in his eyes. Greene, who lived in the apartments, called the man the N-word and told the man “I will kill you, (expletive) kill you,” according to the complaint. Greene pleaded guilty to a lesser harassment charge on June 30, 2014, and was sentenced to one year probation.

In a discharge report filed in June 2015, a probation officer wrote Greene received a mental health evaluation and “reports to have complied with the medication recommendations.”

Wednesday's fatal shootings marked the first time Des Moines has seen a police officer shot and killed in the line of duty since two officers were gunned down in separate incidents in 1977.

Two Des Moines officers, Susan Farrell and Carlos Puente-Morales, died earlier this year when their vehicle was struck head-on by a wrong-way drunk driver.

The killing of the Urbandale officer appeared to be the city's first for an officer shot in the line of duty, officials said.

Parizek thanked the community for its support when the department lost Farrell and Puente-Morales, as well as with the latest tragedy.

"I don't even know where to begin on how bad this year is," he said. But, "this is what we do. We come in day in and day out, we go out there and provide the same level of service regardless of what's going on in our personal and professional lives."

In a statement, Iowa Gov. Terry Branstad called the attack on the officers "an attack on the public safety of all Iowans."

"We call on Iowans to support our law enforcement officials in bringing this suspect to justice," he said. "Our thoughts and prayers go out to the families of the police officers who were tragically killed in the line of duty as well as the officers who continue to put themselves in harm's way."

Iowa Sen. Joni Ernst extended her thoughts and prayers to the families of the officers killed.

"Although the investigation is still unfolding, what appears to be an ambush attack of police in the line of duty is an attack on the community at large and all of the men and women who risk their lives every day to protect us," Ernst said. "This was a senseless act of violence and it cannot be tolerated."

Finney and Haley report for The Des Moines Register. Follow them on Twitter: @newsmanone and @charlyhaley. Stanglin reports for USA TODAY in McLean, Va.