The state Supreme Court has denied an appeal by a Colorado sheriff ordered to release people who are wanted for possible deportation by federal authorities but have paid bond.

The Colorado American Civil Liberties Union filed a lawsuit in February on behalf of two men being held in the El Paso County Jail, arguing that the sheriff’s office was improperly holding them after state law required their release.

The sheriff’s office has argued that it is housing immigrants on federal agents’ behalf.

District Court Judge Eric Bentley ruled in March that Sheriff Bill Elder cannot use immigration authorities’ requests to continue holding immigrants after they pay bond. He ordered the men released.

The Supreme Court on Thursday denied an appeal of that ruling by the sheriff’s office.