HUGHSON, Calif. (AP) — A man shot and killed a deputy in what police termed “an execution,” then stole a car and drove 150 miles to a small central California town where he was arrested after trying to steal a purse from a woman, who fought back and called authorities.

Stanislaus County Sheriff’s Deputy Dennis Wallace was shot twice in the head Sunday morning as he checked on a report of a suspicious van parked near a fishing access spot outside the city of Hughson, about 10 miles southeast of Modesto. He was the fifth California law enforcement officer to die in the line of duty over the last five weeks.

“We believe that Deputy Wallace was killed outside of the car, and we know for a fact that the gun used in this crime was in direct contact with his head when the trigger was pulled twice,” Stanislaus County Sheriff Adam Christianson told reporters. “This was an execution.”

Wallace was alone when he came across the van. A dispatcher told him the vehicle was stolen, so he asked for backup. Another deputy found Wallace a short time later.

The suspect, identified as David Machado fled in the van and carjacked a white Kia sedan in the nearby city of Keyes, police said.

Machado, 37, was arrested later. He was expected to make his first court appearance Tuesday, said John Goold, a chief deputy in the Stanislaus County District Attorney’s Office.

While on the run, Machado committed an armed robbery in the town of Lindsay, about 150 miles south of where the shooting occurred, Christianson said. Then, shortly after noon, he tried to steal a woman’s purse at a convenience store.

The woman fought Machado and called police. He ran away but was caught by officers a short time later.

The Lindsay police officers did not know Machado was the suspect in Wallace’s killing until after he was taken into custody and they identified him through tattoos and a photo issued by Stanislaus County.

Christianson said Machado was wanted on a felony arrest warrant but did not say for what crime. Authorities have recovered the van and the Kia sedan as evidence in the investigation, he said.

Wallace, 53, is survived by his wife, Mercedes, and children. He was a 20-year department veteran who lived and worked in Hughson, where he was involved in youth soccer, refereed football games and taught schoolchildren how to avoid drugs and violence in the D.A.R.E. program.

“He wasn’t just assigned to Hughson; he’s a fixture in Hughson. He was so well-loved,” County Supervisor Vito Chiesa told the Modesto Bee.

Hundreds of people, including law enforcement officers, gathered at the park near where Wallace was shot to mourn his death.

His brother, Modesto Police Officer David Wallace, said all he and Dennis wanted to do was follow in their father’s law enforcement footsteps.

“Dennis died doing what he loved,” he said.

The slaying in Stanislaus County came after a deputy in California’s Modoc County was killed while responding to a call about a disturbance, two Palm Springs police officers were shot to death during a domestic disturbance call, and a Los Angeles County sheriff’s sergeant was shot and killed in the high-desert town of Lancaster while answering a burglary call.

“This tragedy is yet another solemn reminder of the sacrifice men and women in law enforcement make each and every day when they put on the uniform and badge, not knowing if they’ll come home to their families at the end of their shift,” Attorney General and U.S. Sen.-elect Kamala Harris said following Wallace’s killing.