Bail hasn’t always been a mechanism for locking people up. When the concept first took shape in England during the Middle Ages, it was emancipatory. Rather than detaining people indefinitely without trial, magistrates were required to let defendants go free before seeing a judge, guaranteeing their return to court with a bond. If the defendant failed to return, he would forfeit the amount of the bond. The bond might be secured — that is, with some or all of the amount of the bond paid in advance and returned at the end of the trial — or it might not. In 1689, the English Bill of Rights outlawed the widespread practice of keeping defendants in jail by setting deliberately unaffordable bail, declaring that ‘‘excessive bail shall not be required, nor excessive fines imposed.’’ The same language was adopted word for word a century later in the Eighth Amendment to the United States Constitution.

But as bail has evolved in America, it has become less and less a tool for keeping people out of jail, and more and more a trap door for those who cannot afford to pay it. Unsecured bond has become vanishingly rare, and in most jurisdictions, there are only two ways to make bail: post the entire amount yourself up front — what’s called ‘‘money bail’’ or ‘‘cash bail’’ — or pay a commercial bail bondsman to do so. For relatively low bail amounts — say, below $2,000, the range in which most New York City bails fall — the second option often doesn’t even exist; bondsmen can’t make enough money from such small bails to make it worth their while.

With national attention suddenly focused on the criminal-justice system, bail has been cited as an easy target for reformers. But ensuring that no one is held in jail based on poverty would, in many respects, necessitate a complete reordering of criminal justice. The open secret is that in most jurisdictions, bail is the grease that keeps the gears of the overburdened system turning. Faced with the prospect of going to jail for want of bail, many defendants accept plea deals instead, sometimes at their arraignments. New York City courts processed 365,000 arraignments in 2013; well under 5 percent of those cases went all the way to a trial resolution. If even a small fraction of those defendants asserted their right to a trial, criminal courts would be overwhelmed. By encouraging poor defendants to plead guilty, bail keeps the system afloat.

‘‘What, did they arrest all of Brooklyn today?’’ one court officer asked another on a recent Sunday night in one of the two bustling arraignment courtrooms in Downtown Brooklyn. Defendants, a vast majority of them black, paraded past the judge in quick succession: Unlicensed operation of a motor vehicle. Open container of alcohol in public. Marijuana possession. Riding a bicycle on the sidewalk. Misdemeanors, many of them minor, some aggravated by an outstanding bench warrant for failure to appear in court on another case, failure to complete court-ordered community service or failure to pay a fine. Hundreds of people were awaiting arraignment, first in central booking across the street, then in cells on the ninth floor and finally in a small communal cell called ‘‘the pen’’ behind the arraignment courtrooms on the ground floor. On this night, there were more than a dozen men in the cell waiting to see a lawyer, pacing, sitting on benches, crouching in corners.

One man called out from the pen, saying that there was dried excrement in there from the day before. ‘‘Nobody comes in here to clean!’’ he exclaimed. ‘‘It’s mad dirty!’’ A guard approached the bars and briefly sprayed a can of air freshener. Around the corner, the pen opened onto a series of booths, where, separated by heavy metal screens, the defendants met with their lawyers. Scott Hechinger, a senior trial attorney with Brooklyn Defender Services, picked up a stack of case files, quickly scanned the charges and rap sheets, stepped down a short hallway behind the courtroom and started calling names through the mesh screen. The first client was charged with criminal mischief after getting in an argument with his girlfriend and breaking some bowls. It was more complicated than that, he told Hechinger. She came home drunk, threw his clothes out the window. It escalated. He left. They arrested him across the street. Hechinger called the girlfriend and left a message. He called the client’s mother, whom the man lived with. If bail was set, how much could she afford? At most $250. Time’s up. Next case.

A young man jumped a subway turnstile. Prosecutors were offering to make it go away and let him out that night if he did two days of community service and avoided being rearrested for the next six months. This one was easy. ‘‘Take the deal,’’ Hechinger said. It was better than paying a $120 fee.