A wanted man suspected of shooting a sheriff's deputy in "an execution" in Central California was arrested hours later after an alleged crime spree across more than 100 miles, authorities said.

Stanislaus County Sheriff's Deputy Dennis Wallace was shot twice in the head 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, Sheriff Adam Christianson said.

"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," Christianson told a news conference. "This was an execution."

Wallace was alone when he came across the van Sunday morning. 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, 36, fled in the van and carjacked a white Kia sedan in the nearby city of Keyes, police said.

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 from the scene, but he was caught by officers a short time later.

The Lindsay police officers didn't recognize Machado as the suspect in Wallace's killing until after he was taken into custody, when they identified him through tattoos and a photograph issued by Stanislaus County.

Christianson said Machado was wanted for a felony warrant at the time of the traffic stop. He did not elaborate on the alleged crime.

He said authorities have recovered the van and the Kia sedan as evidence in the investigation.

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 by nightfall to mourn his death.

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

"Dennis died doing what he loved," he said.

Wallace is the fifth law enforcement officer in California to die in the line of duty in the last five weeks. The slaying comes after a deputy in 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 Kamala Harris said about Wallace's killing.