You shouldn’t be imprisoned for being poor. But that’s what’s happening to thousands of immigrants across the country who are unable to afford to pay a bond to be released from immigration detention. People accused of immigration violations — who have no criminal record whatsoever — can be assigned exorbitantly high bail that leaves them trapped in detention for years.

Today, members of Congress introduced legislation to prevent immigration detainees from being overcharged for bail. The Immigration Courts Bail Reform Act, co-sponsored by Reps. Jose Serrano (D-N.Y.), Luis Gutierrez (D-Ill.), Zoe Lofgren (D-Calif.), John Conyers (D-Mich.), and 25 other lawmakers, is critical to ensure that no immigrant — whether a legal resident, asylum seeker, or undocumented person — is imprisoned solely because he or she can’t afford to get out.

Bail is not supposed to keep a defendant in jail — but to allow the defendant to leave. The American Bar Association says that judges should use bail to “ensure that defendants will appear for trial and all pretrial hearings for which they must be present.”

In the federal criminal justice system, judges consider the defendant’s financial circumstances when they set bail to ensure that the amount is reasonable. Depending on the case, they can also use alternative conditions of supervision, such as check-ins and travel restrictions, to help guarantee that a person will show up for court.

But outside of the criminal system, immigrants in detention centers are not afforded these same protections.

Take, for example, Cesar Matias. He was arrested by immigration agents in 2012. Matias argued that as a gay man, returning to Honduras — a place of widespread discrimination and deadly violence against LGBT people — could put him at tremendous risk.

The judge in Matias’ case found that he neither posed a risk to public safety or national security nor was a flight risk requiring detention, so the judge granted Matias’ release on a $3,000 bond. Yet Matias went on to spend four years behind bars while his asylum case was pending simply because he could not afford to bail.

Imprisoning people because they are poor is a gross violation of due process and equal protection under the law. In fact, even the Justice Department has argued — on multiple occasions — that jailing someone in this way is unconstitutional. And a growing number of federal courts have agreed.

The ACLU filed a lawsuit on behalf of Matias — and other immigrants like him detained in the Los Angeles area — asserting that judges must take the financial circumstances of immigrants into account when setting bail. Now Congress is offering a political solution to the problem.

Congress should swiftly pass this legislation. Matias has already lost four long years of his life in jail waiting for relief, but we can prevent others from suffering the same senseless loss.