Assemblyman Rob Bonta (D-Alameda), left, and Sen. Bob Hertzberg (D-Van Nuys)

celebrate after the bail overhaul was approved by the Assembly.

California lawmakers on Tuesday passed a landmark bill that would overhaul the state’s cash-bail system, replacing it with one that grants judges greater power to decide who should remain incarcerated ahead of trial.

The proposal moved out of the chamber with a 26-12 vote and now heads to Gov. Jerry Brown, who last year pledged to work with lawmakers and the state’s top Supreme Court justice to pass the legislation.

“Today, the Legislature took an important step forward in reducing the inequities that have long plagued California’s bail system,” Brown said in a statement Tuesday.

The two-year effort puts the state at the forefront of a national push to change the way courts impose monetary fines and payments on defendants as conditions of their release from jail. But the historic victory has been bittersweet for lawmakers, as opponents — including some of the bill’s most ardent former supporters — argued the final version of the legislation could lead to more people behind bars.

Senate Bill 10 would virtually eliminate the payment of money as a condition of release. Under last-minute changes, judges would have greater power to decide which people are a danger to the community and should be held without any possibility of release in a practice known as “preventive detention.”

On the Senate floor, Republicans argued the bill was rushed through the process after major last-minute changes unveiled last week.

Sen. Jim Nielsen (R-Gerber) contended it was passed “in the dark of night.” He said the provisions would automatically grant release to many people, and warned senators would be reading the sad stories of the people they harm.

Sen. Ted Gaines (R-El Dorado Hills) said the bill was likely to face successful constitutional challenges in court, and pointed to the financial burden faced by counties in New Jersey after bail reform efforts in that state.

“It is not a template California should follow,” he said.

But supporters argued the bill was the first step to overhaul a predatory system that hurts poor defendants and had taken into consideration input from law enforcement, as well as recommendations from a judicial task force assembled by state Supreme Court Chief Justice Tani Cantil-Sakauye.

Sen. Holly Mitchell (D-Los Angeles) pointed to provisions in the bill that would require courts to collect and report incarceration rates and undergo in 2023 an independent review of the legislation’s impact on the criminal justice system.

“The reality is…. we don’t thoroughly collect the data to really, unequivocally give us the answer to that question,” Mitchell said, commenting on whether the final version of the bill would lead to worse outcomes in marginalized communities.

Sen. Bob Hertzberg (D-Van Nuys) teared up as he thanked staffers and lawmakers who worked to help pass the bill, saying the Legislature would not come this close to addressing the issue again for a decade.

“The fundamental change is that we are treating people as people,” Hertzberg said.

California’s bail system has long been ripe for reform, both Democrats and Republicans agreed. Police officers and prosecutors point to dangerous or repeat offenders who pay their way out of jail time, bail agents to the high number of people who jump bail and criminal justice advocates to the hefty fees levied on families.

Under Senate Bill 10, co-authored by Hertzberg and Rob Bonta (D-Alameda), counties would have to establish their own pretrial services agencies, which would use “risk-assessment tools,” or analysis, to evaluate people arrested to determine whether, and under what conditions, they should be released.

Only people charged with certain low-level, nonviolent misdemeanors — a list of charges that can be further narrowed by county — would be eligible for automatic release within 12 hours of being booked into jail.

All others arrested would have to undergo the risk analysis, a system that would sort defendants based on criminal history and other criteria into low-, medium- or high-risk categories. Courts would be required to release low-level defendants without assigning bail, pending a hearing. Pretrial services offices would decide whether to hold or release medium-risk offenders. Judges would have control over all prisoners in the system.

Martin Hoshino, administrative director of the Judicial Council, said the organization looked forward to working with Brown and lawmakers on implementation, which tasks the judicial group with developing standards for counties on the best practices to follow on risk assessments.

Some organizations that have supported the legislation from the start applauded the bill’s passage.

“For decades, the money bail system has created a two-tiered system that prioritizes profit and penalizes poverty, and has been especially detrimental for communities of color,” California billionaire activist Tom Steyer, president of progressive advocacy organization NextGen America, said in a statement.

Laphonza Butler, president of the Service Employees International Union Local 2015, called the bill’s passage a turning point, saying it “would make California the first state in the nation to completely eliminate the use of money to determine detention.”

But other criminal justice reform groups, including the American Civil Liberties Union, have rescinded their support and actively worked to kill the legislation — landing on the same side as a bail industry that has worked to sink the bill from the beginning.

On the Senate floor, lawmakers warned the bill would decimate an industry of roughly 3,200 registered agents in California. Outside the Senate chamber, Sacramento bail agent Greg “Topo” Padilla, president of the Golden State Bail Agents Assn., said his organization was already looking into ways to block the legislation, either in court or through a voter referendum.