EVEN AS THE Trump administration begins to regress on criminal justice, states continue to find more rational and humane ways to handle crime. In New York, for example, which currently runs an unjustifiably harsh criminal justice system, reform is taking place on several fronts.

One of the most urgent is the state’s current practice — only one other state does this — of routinely treating 16- and 17-year-olds as adults in criminal court. The New York legislature passed a 2018 budget last week that would phase out that archaic treatment of teenagers. Sixteen- and 17-year-olds charged with misdemeanors will go to family court, and those facing felony counts will go before judges in a youth branch of the criminal court system. Some charged with violent felonies could still end up in adult criminal court, but only if their crime is particularly heinous.

Inasmuch as it represents a compromise between activists fighting for even more lenient rules and a more skeptical Republican state Senate, this reform did not please everyone. But the reform nevertheless raises the bar high for trying any juvenile as an adult. Judges specializing in minors will preside in nearly every case involving a juvenile offender, which is crucial: Teenagers’ handling should reflect the fact that their brains and judgment are still in a developmental stage, and it is better in the long run to try to divert them from a criminal path.

Their treatment in confinement also will improve. Charging 16- and 17-year-olds as adults threw many vulnerable youngsters into facilities designed and run for adult jail populations. Next year, the state will stop holding those under 17 in county jails, with the age rising to 18 and under in 2019.

Though it grabbed fewer headlines, New York’s leaders also reformed the state’s indigent defense system, which provides free legal counsel to defendants who cannot afford a lawyer. Until now, the state’s system was run county by county, and it was intolerably spotty. The state will now take more responsibility for ensuring proper standards and funding.

Finally, state and city leaders agreed earlier this month to close the notorious Rikers Island jail, which had become, in the words of former New York chief judge Jonathan Lippman, “an affront to humanity and decency.” In 2014, Preet Bharara, then the U.S. attorney for the Southern District of New York, characterized the lockup as a place where “beatings are routine while accountability is rare,” releasing a damning report on the “culture of violence” at Rikers that detailed how staff used unnecessary force and banished people to solitary confinement.

Under the city’s plan, Rikers may become the site of an airport runway or a water treatment plant, while prisoners will be held in five smaller lockups around the city. The proposal depends on cutting the number of prisoners, in part through better management of inmates in pretrial detention. Officials must neither replace one Rikers with several smaller versions of the same thing nor turn people loose who should be held before trial.

Careful reform can improve lives and save money without endangering the public. Attorney General Jeff Sessions should take note.