SAN FRANCISCO (AP) — A suspected drunk driver accused of fatally shooting the California police officer who pulled him over was captured Friday as he tried to flee back to Mexico, where he lived before illegally crossing into the U.S., authorities said.

The sheriff whose agency was leading the investigation blamed California’s sanctuary law for preventing local authorities from reporting Perez Arriaga to federal immigration officials for previous arrests. If the suspect had been deported, he said, Cpl. Ronil Singh of the tiny Newman Police Department would still be alive.

“We can’t ignore the fact that this could have been preventable,” Stanislaus County Sheriff Adam Christianson said, asking why the state was “providing sanctuary for criminals (and) gang members. It’s a conversation we need to have.”

Gustavo Perez Arriaga was arrested near Bakersfield, about 200 miles southeast of the scene of the shooting. He crossed the border in Arizona several years ago and had worked a variety of jobs as a laborer, including at several dairies. He also had two prior arrests for driving while intoxicated, Christianson said.

The 33-year-old Mexico native had gang affiliations and multiple Facebook pages with different names, the sheriff said.

Authorities also arrested the suspect’s brother, 25-year-old Adrian Virgen, and a co-worker, 32-year-old Erik Razo Quiroz, who lied to police to try to protect him, Christianson said.

Christianson spoke at a news conference about making laws stricter as Singh’s brother wept beside him.

Singh, also 33, was an immigrant too, arriving legally from his native Fiji to fulfill his dream of becoming a police officer, authorities said. He had a newborn son and joined the 12-officer Newman police force in 2011.

“He came to America with one purpose, and that was to serve this country,” Newman Police Chief Randy Richardson said, choking up. He called Singh an “American patriot.”

Singh, the department’s first officer to die in the line of duty, drove more than two hours each way to attend the police academy in Yuba City, Richardson said. He joined the Merced County sheriff’s office as a reserve officer and worked as an animal control officer in Turlock before being hired by the Newman force in 2011.

English was Singh’s third language. He had a thick accent but took speech classes to improve his communication, the chief said.

The shooting on Wednesday came amid a political fight over immigration, with President Donald Trump and congressional Democrats at odds over funding for a border wall that has forced a partial government shutdown.

Trump tweeted about Singh’s killing Thursday, saying it was “time to get tough on Border Security. Build the Wall!”

The arrest followed a statewide manhunt.

When a gunfight broke out, Singh tried to defend himself but apparently did not hit the suspect, Christianson said.