A federal judge in Houston Friday issued a scathing denouncement of Harris County's cash bail system, saying it is fundamentally unfair to detain indigent people arrested for low-level offenses simply because they can't afford to pay bail.

In a 193-page ruling released Friday, Chief U.S. District Judge Lee H. Rosenthal ordered the county to begin releasing indigent inmates as early as May 15 without posting cash bail while they are awaiting trial on misdemeanor offenses.

District Attorney Kim Ogg and County Commissioner Rodney Ellis - both of whom filed statements of support with the court for the lawsuit - praised the ruling.

"This is a watershed moment in Harris County criminal-justice history," Ogg said in a statement late Friday. "From now on, people can't be held in jail awaiting trial on low-level offenses, just because they are too poor to make bail. ... We welcome the ruling and will comply fully with it."

Ellis said he was pleased with the ruling.

"Harris County's bail system is unconstitutionally discriminatory and morally indefensible – and we now have a federal court ruling telling us so," Ellis said in an email. "It's time for us to fix a broken justice system that favors the privileged and punishes the poor for being poor."

The ruling came five weeks came after a lengthy, high-profile hearing in which more than a dozen witnesses took the stand, including several judges and Sheriff Ed Gonzalez.

Monetary bonds have been used for generations across the country to ensure people arrested by police return for court dates, and several jurisdictions around the country have begun to rethink how bail should be set.

The ruling came five weeks came after a lengthy hearing in which more than a dozen witnesses took the stand, including several judges and Gonzalez.

The lawsuit was filed last year by two civil rights group - Texas Fair Defense Project and Civil Rights Corps - and local law firm Susman Godfrey law firm on behalf of Maranda Odonnell, a single mother who was held for two days on a charge of driving without a valid license because she couldn't afford the $2,500 bail.

The suit names top county officials and a string of judges and hearing officers. Similar lawsuits filed on behalf of two other people were merged into the case in August.

The ruling notes that the case is "difficult and complex," and is among many similar cases filed across the country challenging bail practices.

The order notes that the judge reviewed "many hours of footage" from 2,300 recordings of misdemeanor probable cause hearings that were placed into evidence. The ruling cites two videos as being "illustrative" of the problems face by misdemeanor defendants.

In one case, a man whose criminal history was wrongly calculated by the hearing officer eventually pleaded guilty to gain release. In another, the hearing officer laughed and made a "wisecrack" that he felt better that the man was returning to jail.

The ruling also cites reports showing that of the 50,000 people arrested in Harris County on Class A or Class B misdemeanors in 2015, fewer than 10 percent were released on unsecured personal bonds.

She concluded that even if hearing officers were not acting deliberately, the county had been using money bail as a form of preventive detention.

Gonzalez, through a spokesman, said his office would immediately begin looking into how to implement the order. The sheriff also filed court papers indicating he supports an end to costly bail for indigent defendants.

The ruling drew praise from others pushing for change to the bail system.

"It's my hope this decision and decisions like it will eradicate the notion of wealth-based detention from our legal system," said Alec Karakatsanis, of the Civil Rights Corp.

Neal Manne, a managing partner at Susman Godfrey, which is donating its services, said the judge recognized the crushing impact that cash bail can have on poor people.

"We showed in effect the money bail system was being used to achieve something the Texas Constitution does not permit," Manne said.

Christina Swarns, head of litigation for the NAACP Legal Defense and Educational Fund in New York, likewise praised the ruling.

"One's punishment should fit their crime, not their bank account," Swarns said. "Harris County's bail practices unlawfully create a cycle of poverty for those who cannot afford the cost of their freedom."

Tarsha Jackson, the criminal justice director for the Texas Organizing Project, urged the county to not challenge the ruling.

"Harris County would do right to accept the judge's ruling and not appeal. Unfortunately, we expect an appeal," Jackson said.

The judge indicated Friday she would rule on the legality of the current system before July 1.

Harris County has already spent more than $2 million fighting the lawsuit, and recently hired an additional attorney to help with appeals.

Soard said the county had retained veteran D.C. appellate lawyer Charles Cooper to represent the interests of 15 county criminal court of law judges who oppose the lawsuit.

Cooper will advise whether the judges should appeal the ruling. The remaining court of law judge testified at the injunction hearing that although he is a defendant in the lawsuit, he supports changing the way bail is issued.

The remaining defendants for the county have appellate counsel from the firms who will review the question of an appeal, he said.