REDWOOD CITY (CBS SF) — A San Mateo County Superior Court judge on Friday ordered the federal government to produce a criminal defendant held by immigration officials so he can stand trial for assault with a deadly weapon, according to prosecutors.

Judge Elizabeth Lee granted a writ of habeas corpus ad prosequendum, aimed at requiring U.S. Immigration and Customs Enforcement to return 35-year-old Bulmaro Maldonado Sanchez to San Mateo County, according to Deputy District Attorney Karen Guidotti.

Sanchez was arrested in April after allegedly stabbing a coworker several times in what his defense attorney calls an act of self-defense.

After posting bail, but before he was released, Sanchez was picked up by immigration officers and taken to the Contra Costa County jail in Martinez and then to an ICE holding facility at the Yuba County jail, according to his attorney Jesse Garcia.

“He was never released, just delivered to the custody of ICE,” Garcia said. ICE was able to identify Sanchez for possible deportation using the fingerprints he was required to submit when he was booked.

Those fingerprints were put to into a U.S. Department of Justice database, which ICE accesses for the purpose of determining which defendants they want to take into custody.

The San Mateo County Sheriff’s Office, which runs the jail, does not identify defendants based on immigration status or communicate with ICE directly, said sheriff’s spokesman Detective Sal Zuno.

“We don’t enforce federal law,” Zuno said. “When people are arrested we don’t know their immigration status and we don’t ask.”

Sanchez was scheduled to appear in a San Mateo courtroom on June 20, but was unable to make it because he was being held by ICE at the time.

A judge issued a bench warrant for Sanchez because otherwise the court essentially would be giving up jurisdiction over him, Guidotti said.

Judge Lee on Friday ordered his return to San Mateo County for trial and set bail at $10,000.

“My hope and expectation is that they’ll bring them back,” Garcia said, noting that neither the district attorney’s office nor the sheriff’s office opposed the order.

Sanchez, a San Leandro resident, is accused of stabbing a 41-year-old man who he worked with in the kitchen of Town Restaurant in San Carlos.

The pair got into an argument during work, which was carried out into the parking lot after their shift ended at about midnight on April 29, according to prosecutors.

“My client was attacked in a parking lot when he got off work,” Garcia said.

Prosecutors say the victim threw the first punch to start the fight and then Sanchez pulled a knife and stabbed him multiple times in the torso, shoulder and armpit.

If ICE releases Sanchez back into the custody of local law enforcement, he is expected to appear in court on July 17 to determine the status of his case, Guidotti said.

A call to ICE seeking comment was not immediately returned.

TM and © Copyright 2017 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2017 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Bay City News Service contributed to this report.