An undocumented immigrant suspected of fatally shooting a police officer in the U.S. western state of California has been apprehended, bringing an end to a two-day manhunt.  

Gustavo Perez Arriaga, a 32-year-old Mexican national, was arrested Friday.  

He is accused of shooting to death Newman, California police Corporal Sonil Singh after Singh pulled him over on suspicion of driving under the influence.

Stanislaus County Sheriff Adam Christianson blamed the state’s sanctuary law for the police officer’s death.  

He said the law prevented police from reporting Arriaga to immigration officials for deportation after two previous drunken driving arrests.  Christianson added that Arriaga had gang affiliations.

California Governor Jerry Brown disputed Christianson’s claims that officials could not report Arriaga to immigration authorities.  

Brown’s spokesman said the law “fully permits the sharing of information on dangerous gang members.”

The slain police officer was also an immigrant, arriving legally from his native Fiji to fulfill his dream of becoming a police officer.

The fatal incident happens in the midst of a partial federal government shutdown that U.S. President Donald Trump has initiated because he wants Congress to allocate $5 billion towards building a wall at the U.S. border with Mexico.

The president wants the wall to keep out South and Central American migrants that he has characterized as criminals and rapists.

However, multiple studies have found immigrants commit crimes at lower rates than U.S.-born citizens.