DES MOINES, Iowa -- An Iowa man charged Thursday with fatally shooting two police officers in ambush-style attacks was under intense financial pressure and had been ordered to move out of his mother’s basement just hours before the slayings.

Scott Michael Greene Des Moines Police Department

Scott Michael Greene, 46, was arrested Thursday afternoon after detectives questioned him at the Des Moines police station. Greene was secured with the handcuffs that had belonged to the patrolmen who were killed, Des Moines Sgt. Anthony Beminio and Urbandale officer Justin Martin, and was being transported to the county jail.

Greene was charged with two counts of first-degree murder. If convicted, he would receive an automatic sentence of life in prison without parole. A statement from Des Moines police said the investigation has produced probable cause to support the charges but didn’t elaborate.

Police said earlier Thursday that a search dog recovered a high-powered rifle in a wooded area that they believe Greene used to fire on the officers. Greene had been hospitalized for treatment of a pre-existing medical condition following his surrender Wednesday morning. He left the hospital Thursday.

Get Breaking News Delivered to Your Inbox

Court documents show that Greene, an unemployed father who lived in the Des Moines suburb of Urbandale, was increasingly desperate for money in recent weeks.

District Judge Carla Schemmel ruled Tuesday that Greene had committed elder abuse against his 66-year-old mother, Patricia Greene, by “physically hitting and financially exploiting” her. She ordered him to move out of his mother’s home, where he had been living in a basement bedroom, before Nov. 6 and to stay away from the home for a year.

Urbandale police officers gather outside the home of Scott Michael Greene, the suspected gunman of two police officers who were shot and killed in separate attacks described as “ambush-style” in Urbandale and Des Moines, Iowa, Nov. 2, 2016. Reuters/Scott Morgan

Patricia Greene had applied for the restraining order Oct. 19, two days after she was arrested and charged with striking her son in the face during an altercation that he had recorded with his cellphone. She wrote in the application that she believed her son “set me up to get me in trouble.” Patricia Greene wrote that while she was in jail, Scott Greene told one of her friends that Patricia Greene needed to give him $20,000 and that if his mother paid, “he would move and not bother” her again.

Patricia Greene also wrote that her son had sent “a bunch of rambling, offensive” text messages, warned that he would no longer take care of her cat and was going through her personal belongings. She said her son had subjected her to mental, emotional and financial abuse.

A temporary protective order was issued Oct. 20. Schemmel issued the permanent order during Tuesday’s hearing, where it was served on Scott Greene. The order, which warned that any violations would lead to his arrest, also directed Greene to return $10,000 to his mother and to not take any of her assets.

Beminio, 38, and Martin, 24, were shot after 1 a.m. Wednesday while sitting in their patrol cars in separate incidents less than 2 miles apart. Several bullets were fired into the vehicles.

The .223-caliber rifle believed to be used was discovered Wednesday by a dog with the federal Bureau of Alcohol, Tobacco, Firearms and Explosives apparently hidden in a wooded area “where no person probably could have found it,” said Des Moines police spokesman Sgt. Paul Parizek.

Parizek became emotional Thursday during a news conference, where he thanked the community for its outpouring of support and said the officers represent “the security blanket you guys sleep under every night.” He said a motive for the shootings remains unclear.

Greene was hired last month to work at Central Iowa Fencing, a small construction business in suburban Des Moines, but quit within days, a manager there said Thursday.

Greene “was pretty desperate” for a job and told the company he had a teenage daughter he needed to support, officer manager Sara Nicklin said. Greene initially contacted the company looking for work last summer but there were no openings. The company gave Greene a chance after he inquired again last month, even though he had no experience building fences, Nicklin said.

She said Greene was sent home on the morning of his third day of employment “because he was not taking directions and wasn’t working.” Nicklin said the company gave Greene the chance to come back the next day on a different crew but “he chose not to show up” and quit instead.

“He just didn’t like the work,” Nicklin said.

Greene posted a video on YouTube last week of a cellphone recording showing a worker driving a truck. Greene wrote below the video that he “was fired” by Central Iowa Fencing after reporting unsafe driving.

Nicklin said she hasn’t seen the video but denied that Greene was fired. She said investigators have contacted the business, which has about 20 workers.

“We wish we never would have contact with this person,” she said. “We’re all devastated.”