A California deputy was killed Sunday morning after being shot twice at point-blank range, and the suspect was in custody after a four-hour manhunt, authorities said.

Stanislaus Sheriff's Deputy Dennis Wallace was killed on Sunday, Nov. 13. Stanislaus County Sheriff's Department

At a news briefing, Stanislaus County Sheriff Adam Christianson described the killing of Dennis Wallace, 53, as an "execution."

The suspect, identified as David Machado, 37, was captured 150 miles south of where the killing occurred, Christianson said Sunday afternoon.

Christianson said Wallace, a 20-year veteran, was investigating a suspicious vehicle at a park in Hughson, in California's Central Valley, at 8:24 a.m. (11:24 ET).

When a dispatcher told Wallace that the van was stolen, the deputy requested assistance.

We have confirmed David Machado is in custody. We will advise the media when we will hold a press conference here at the Sheriff's Office. — Stanislaus Sheriff (@StanSheriff) November 13, 2016

Moments later, Christianson said, Wallace was shot twice in the head.

"This was an execution," he said, adding that investigators believe Wallace was killed outside his vehicle.

David Machado, 37, was wanted in the killing of Stanislaus County, California, Sheriff's Deputy David Wallace. Stanislaus County Sheriff's Department

Machado, who was wanted on a felony warrant, fled and carjacked someone for a white 2009 Kia eight miles southwest of Fox Grove, in the community of Keyes, Christianson said.

Christianson did not provide details about the warrant.

Machado was arrested at 12:33 p.m. (3:33 p.m. ET) in the city of Lindsay after he allegedly tried to steal a woman's purse. When she fought back, Christianson said, Machado fled on foot and the woman dialed 911.

Christianson said Wallace left behind a wife and a family and was well-known for his participation in drug-prevention programs.

"He had a special place in our hearts at the sheriff's office," he said.