It's a bail bondsman's job to make sure a defendant shows up for court.
But inside the Dallas County jail, magistrates sign stacks of forms letting bondsmen off the hook.
And that creates a loophole allowing citizens of foreign countries who are accused of crimes to be deported instead of going to trial.
In one case, Richardson police said Teofilo Martinez, a Mexican citizen, pulled a gun during a knife fight this summer. They charged him with aggravated assault with a deadly weapon.
It's a crime that carries a maximum of 20 years in prison.
But Martinez never went to trial.
In less than 10 days, he was out of jail and back in Mexico, walking free.
As many as 1,000 illegal immigrants charged with serious crimes, including rape and murder, have been deported before going to trial in Dallas County. A legal document, called an Article 17.16 of the Texas Code of Criminal Procecure, is what helps some of them escape justice.
A 17.16, entitled "Discharge Of Liability; Surrender Or Incarceration Of Principal Before Forfeiture," is supposed to protect a bondsman's investment. If his defendant is re-arrested and brought back to jail while out on bond, a 17.16 relieves the bond company of its financial responsibility.
But there's a loophole for some bail companies that write bonds for illegal immigrants who are slated for deportation.
Here's how it works.
A bail company writes a bond -- and sometimes within hours, while the defendant is still in jail -- they file a 17.16 canceling their financial responsibility.
But the defendant who posted the bond never gets out. Instead, an alert goes out to Immigration and Customs Enforcement, or ICE. They put him on a bus and set him free in Mexico, and the bond company is now off the hook and may keep the money.
It's all legal.
"They don't have any incentive to do anything because their bond is no longer at risk," said Dallas County Judge John Cruezot.
In the case of Teofilo Martinez, Maverick Bail Bonds posted his $7,500 bond for the aggravated assault charge.
That same day, Maverick also filed a 17.16 that canceled its financial responsibility for Martinez, just as he was sent back to Mexico and set free.
Maverick declined our request for an interview.
"The bond's the mechanism," Cruezot said. "That's what triggers all of this, is the bond. The question is, what happens to the money."
While the problem has persisted for years in Dallas County, in Collin County they fixed the problem with a fax machine and better communication.
District Attorney John Roach said the solution is not an extraordinary expense.
"No, actually, it's not," Roach said. "We just pay attention."
In Collin County, all 17.16s are faxed to the district attorney's office. If one of them indicates a defendant is now in federal custody, county officials said they act quickly to get him back before he is deported.
"It's just part of the job," Roach said.
Roach instituted the procedure following the case of Marcelino Diaz-Gomez. He was charged with sexually assaulting a minor.
But like so many others, he posted bond and was deported before going to trial. The district attorney said monitoring 17.16s to keep a watch on accused criminals before they escape has helped close that loophole.
But in Dallas County, 17.16 forms are rarely, if ever, shared with judges or the district attorney in a timely fashion.
As a result, county authorities rarely know if a defendant has escaped justice until long after it's happened.