CHICAGO — A newly filed lawsuit says thousands of poor, largely African-American inmates are being held improperly at the Cook County jail because they cannot afford to post cash bail.

The lawsuit, filed in Cook County Circuit Court on Friday by attorneys for two inmates, Zachary Robinson and Michael Lewis, seeks class-action status on behalf of others in jail custody.

It names several Cook County judges and Sheriff Tom Dart as defendants.

The plaintiffs say the practice under Illinois law of setting bail amounts in excess of what inmates can pay violates their constitutional rights.

Sheriff’s Department Chief Policy Officer Cara Smith says Dart “has worked tirelessly to change” a bail system she calls “unconscionable.” Smith says naming Dart in the lawsuit was “puzzling and defies logic.”

The lawsuit was first reported by Injustice Watch, a not-for-profit journalism organization.