Two men who were awaiting trial on unrelated murder charges when they escaped from a California jail were arrested by federal officials at the U.S.-Mexico border Wednesday when they tried to “walk across to get back into the United States,” the Monterey County Sheriff's Office says.

Santos Fonseca, 21, and Jonathan Salazar, 20, were taken into custody by U.S. Customs and Border Protection agents around midnight Wednesday morning after they tried re-entering the U.S. near Tijuana, police say.

Both men are gang-related murder suspects and had been considered dangerous since their escape from a jail in Salinas early Sunday. It was not immediately clear how the men made it into Mexico following their escape, or why they wanted to return to the U.S.

The Monterey County Sheriff's Office said its officers raced down to the border early Wednesday morning for the custody transfer of Fonseca and Salazar. The pair is now being driven back to jail in Salinas, south of San Jose.

WANTED TENNESSEE INMATE CAUGHT AFTER BEING SPOTTED RIFLING THROUGH STRANGER'S REFRIGERATOR

Salazar and Fonseca busted out of the Marin County Jail after climbing through a hole they made in the ceiling of a bathroom, squeezing through a hollow wall and kicking open a hatch.

They had been in custody since 2018 and were awaiting trial on murder counts and "numerous other felony charges" in separate cases.

Salazar was arrested in the shooting death of a 20-year-old man as the victim drove in Salinas with his girlfriend and 18-month-old son. The woman was shot and treated at a hospital, while the child wasn't hurt.

Police investigated the Oct. 12, 2017 shooting as gang-related. Officers said his tattoos, including the letter P on his cheek, refer to his Sureño offshoot gang, La Posada Trece, according to The Californian newspaper. His trial was scheduled to begin in January.

Fonseca is charged with shooting a 37-year-old man to death on June 2, 2018, while the victim sat in his car on a video call with his wife in Mexico, The Californian reported.

She saw a scuffle, heard her husband screaming "no" and then gunshots rang out, Salinas police Officer Froylan Aranda testified at a preliminary hearing in March.

CLICK HERE FOR THE FOX NEWS APP

Fonseca told police that his gang leader ordered him to kill someone to prove he was still loyal to the "Boronda gang," according to The Associated Press, citing testimony from detective Gabriela Contreras. The victim was reportedly chosen at random.

Three days later, Fonseca shot and killed a 27-year-old man in a Salinas park, authorities said. He told police that the gang leader also ordered the slaying and that he picked his girlfriend's ex-boyfriend "to send him a message."

Fox News’ Frank Miles and Nicole Darrah and the Associated Press contributed to this report.