Des Moines — A white man with a history of racial provocations and confrontations with police ambushed and fatally shot two white officers in separate attacks as they sat in their patrol cars, authorities said.Police took 46-year-old Scott Michael Greene into custody hours after the killings on Wednesday, less than three weeks after he argued with officers who removed him from a high school football game where he had unfurled a Confederate flag near black spectators.Greene flagged down an Iowa Department of Natural Resources employee in a rural area west of Des Moines, identified himself and asked that the employee call 911. Sheriff's deputies and state patrol officers took him into custody.Green has not been formally charged, but he remained hospitalised on Thursday for treatment of an existing condition, Des Moines police Sergeant Paul Parizek said.Greene's suspected in the early morning slayings of 24-year-old Justin Martin, who had been with the force in the Des Moines suburb of Urbandale since 2015, and 38-year-old Sergeant Anthony Beminio, who joined the Des Moines department in 2005.Police responded to a report of shots fired shortly after 01:00 and found the Urbandale officer. Authorities from several agencies soon saturated the area. About 20 minutes later, they discovered the Des Moines officer, who had responded to the first shooting, Parizek said.The shootings happened less than 3km apart, and both took place along main streets that cut through residential areas.In the first shooting, investigators believe the gunman walked up to the officer's car and fired more than two dozen rounds.'Constitutional right'"I wouldn't call it a confrontation," Urbandale Police Chief Ross McCarty said. "I don't think he may have even been aware that there was a gunman next to him."Greene appeared to have issues with people of other races.In the confrontation at the Urbandale High School football game, which Greene videotaped and posted on social media, he appeared to be trying to antagonise African-American fans when he shook a Confederate flag in front of them during the national anthem, McCarty said.In the video, officers can be seen asking Greene to leave school property while he insists he was assaulted and his flag was stolen. He demands officers file theft and assault charges, saying someone hit his head and grabbed the flag.In a back-and-forth with officers that lasts for nearly 11 minutes, officers say they could take a report but they cannot let Greene back inside the stadium because the school has banned him from the property. They also note they were returning his flag and ask if he purposely wanted to create a conflict by displaying it near African-Americans."I was peacefully protesting," he responds. "That's my constitutional right."The video ends with Greene promising not to "set foot on" school property and officers saying they will take down his information.In other incidents, court records show Greene was jailed and charged with interfering with official acts after resisting Urbandale police officers who tried to pat him down for a weapon on April 10, 2014. An Urbandale officer described him as hostile and combative. Greene entered a guilty plea and was fined.Two days later, Urbandale police were called to answer a complaint of harassment at the apartment complex where Greene lived. The complaint said he threatened to kill another man during a confrontation in the parking lot and yelled a racial slur used against blacks. Greene was charged with harassment.He pleaded guilty and received a suspended jail sentence and a year of probation. An officer wrote that Greene had complied with the terms of his probation, noting that he had obtained a mental health evaluation and "reports to have complied with the medication recommendations". The officer did not elaborate.The Urbandale police chief said Greene was well-known to officers.Most officers in the city "have some understanding of Mr Greene," McCarty said. "They've taken trips to his house, delivered service to him — never anything to this extent."It was unclear if either of the shootings were captured on police cameras.