A man suspected of gunning down a California police officer during a traffic stop was arrested Friday after a two-day search.

Gustavo Perez Arriaga was detained in Bakersfield by the Kern County Sheriff's Office at a residence about 200 miles south of where the shooting occurred, said Stanislaus County Sheriff Adam Christianson.

Arriaga, 32, is accused of fatally shooting Newman Police Cpl. Ronil Singh, 33, after the officer stopped him early Wednesday morning on suspicion he was driving under the influence. He is facing a homicide charge.

Gustavo Perez Arriaga was arrested in connection to the fatal shooting of an officer during a traffic stop in Northern California. Stanislaus County Sheriff's Department

Seven others were also arrested for allegedly aiding or abetting Arriaga after the killing or allegedly trying to divert investigators. Four of the arrests were announced by the Stanislaus County sheriff's office and three by the Kern County sheriff's office.

Adrian Virgen, 25, and Erik Razo Quiroz, 27, were taken into custody Friday on suspicion of trying to divert investigators during a felony investigation, Christianson said at a news conference.

In a statement Friday night, the sheriff's department said Arriaga's girlfriend, Ana Leyde Cervantes, 30, was arrested in Turlock and his brother, Conrado Virgen Mendoza, 34, was arrested in Livermore. The two allegedly aided "Arriaga in evading authorities following the murder of Corporal Singh," according to the statement on Facebook.

"Anyone who provided protection is going to go to jail," Christianson said during the news conference.

Singh's brother, Reggie Singh, also attended the news conference. Through sobs, he thanked law enforcement officers involved in Arriaga's arrest.

"I was waiting for this to happen," he said. "You working day and night made this happen."

Christianson said Arriaga had been arrested twice before on DUI charges, had known gang affiliations and was trying to flee to Mexico when officers apprehended him.

Adrian Virgen, left, and Erik Razo Quiroz were arrested in connection with the death of Newman Police Corporal Ronil Singh. Stanislaus County Sheriff's Department

"This criminal, Mr. Arriaga, crossed our border illegally into Arizona some time ago," Christianson said, describing Arriaga as a farm laborer and dairy worker.

"He’s been in this country for several years," he said.

President Donald Trump on Thursday tweeted about the killing: “Time to get tough on Border Security. Build the Wall!”

Trump has on multiple occasions highlighted crimes committed by people in the U.S. illegally as he pushes for border security.

Christianson said Friday he did not want to "talk about the president of the United States," but said California's so-called sanctuary law, Senate Bill 54, signed by Gov. Jerry Brown late last year, would have prevented authorities from reporting a misdemeanor DUI arrest to immigration agents.

"Law enforcement was prohibited because of sanctuary laws, and that led to the encounter with Officer Singh," he said.

Singh immigrated to the U.S. from Fiji and joined the Newman Police Department in 2011. Earlier in his career, he was a reserve deputy with the Merced County Sheriff’s Office. He was a husband and a new father to a 5-month-old boy.

Kern County Sheriff Donny Youngblood told reporters Friday that just before his team was preparing to execute a search warrant, Arriaga walked out with his hands up and surrendered to officers. Arriaga was unarmed, according to Youngblood.

Three adults who were in the home — Bernabe Madrigal Castenada, 59, Maria Luisa Moreno, 57, and Erasmo Villegas, 36 —were also arrested on suspicion of aiding and abetting Arriaga.

Officer Ronil Singh of the Newman Police Department and his family on Christmas Day. Grand Prairie Police Department via Twitter

"He will never see his son walk. He doesn't get to hold that little boy, hug his wife, say goodnight anymore — because a coward took his life,” Newman Police Chief Randy Richardson said, adding that the small Newman Police Department has never seen a line of duty death.

Richardson was emotional Thursday when he spoke about the slain officer during a news conference.

"I did not know Christmas morning, at 4 o'clock in the morning when I said goodbye to him and sent him off to his family that it would be the last time that I saw him," Richardson said.

A photo taken that day shows Singh and his K-9 in uniform along with his wife and baby and his K-9 posing in front of a Christmas tree. The K-9, Sam, will retire and remain with the family.