SACRAMENTO, Calif. — A man armed with an assault rifle shot three sheriff’s deputies and a civilian, killing two of the deputies and leading dozens of police officers on a wild six-hour chase and manhunt Friday. The pursuit spanned two Northern California counties before the 34-year-old suspect was taken into custody.

Marcelo Marquez, of Salt Lake City, was taken alive Friday afternoon from a home in Auburn in Placer County after the initial shooting hours earlier in a strip mall in a commercial area of Sacramento, said Placer County Sheriff’s spokeswoman Dena Erwin.

“This guy was on a one-man crime spree today. He has no idea of the damage he did,” she said.

The four shootings sparked a massive manhunt by multiple agencies backed by search dogs, helicopters and armored vehicles. Residents nearby were told to stay indoors, and schools were locked down during the search. The owner of the home said officers used tear gas to drive the suspect from the basement.

The slaying of the deputies was the single deadliest day for California law enforcement since February 2013. In separate incidents that month, former Los Angeles police officer Christopher Dorner killed two law enforcement officers, and two Santa Cruz police detectives were shot and killed.

A woman who was with the suspect earlier was also taken into custody in Placer County, and authorities said she had a handgun in her purse. Marquez was taken to a hospital before he could be booked into jail, Erwin said.

Sacramento County Sheriff Scott Jones said the deadly chain of events began when Deputy Danny Oliver, 47, approached a suspicious occupied vehicle in a Motel 6 parking lot around 10:30 a.m. and was shot in the forehead at close range. Oliver, the first county deputy killed since 2008, was a 15-year veteran who leaves behind a wife and two daughters.

“He was not able to return fire or do anything,” Jones said. He said Oliver’s partner was able to shoot back as the vehicle fled the scene.

“We live as a family. Today we grieve as a family,” Jones said.

The driver of the vehicle and a female passenger fled the scene. About a mile away, the suspect attempted to steal a car in a residential area, but shot the driver in the head when he refused to give up his keys, Jones said. He did not know the condition of that victim but said the man was alive and conscious when he was taken to the hospital.

The assailants then stole a red Ford pickup from Jose Cruz, who was gardening outside a client’s house in Sacramento.

Cruz told The Sacramento Bee that a man in a white Ford Mustang convertible told him he needed a favor: “I need your keys,” the man said. “Hurry up, because they’re chasing me.”

Cruz said the man pointed a gun at him and had a bloody shirt wrapped around his other arm.

“I feel lucky that he didn’t hurt me,” Cruz said.

The suspects then fled to neighboring Placer County, about 30 miles north of Sacramento, where the assailant allegedly shot two Placer County sheriff’s deputies in Auburn.

Erwin said a resident reported seeing a vehicle that matched the description of the stolen red truck. Deputies swarmed the area, and the suspect shot two deputies with an AR-15-type assault weapon before fleeing into a wooded canyon area, Erwin said. She did not immediately release the deputies’ names or other identifying information, but she said the second Placer County deputy was shot in the arm and was expected to survive.

Laura Larson, who lives at the Auburn home where the suspect was apprehended, told KCRA-TV that her uncle was at home when Marquez broke in but her uncle survived.

She said police used tear gas and some windows were broken at the home. The residence was still considered a crime scene Friday evening and the family was not being allowed to return, she said.

She said Marquez was taken in the basement of the home. She said her family has “no idea who this guy is.”

House painter Sean Smith of Sacramento said he was working on the Auburn mayor’s home when he heard a series of gunshots.

“Once I heard the rapid fire, I knew it was a shootout,” he said. “Within 10 minutes there were sirens all over the place and six helicopters screaming overhead.”

——

Associated Press writers Judy Lin, Juliet Williams and Alina Hartounian and AP photographer Rich Pedroncelli contributed to this story.