In requiring stunningly long sentences, the crime bills took power away from judges to make decisions based on a defendant’s unique circumstances — that is, to judge — at the moment such discretion was most needed. Mr. Rhines’s judge might have taken into account not only the nonviolent nature of his crime, but also that by the age of 7, he was watching his mother use heroin and get physically abused by multiple boyfriends. Or that because of her drug addiction, he and his brothers and sisters went for stretches without food, heat, electricity or hot water. Or that he stopped going to school at 11 to provide for his siblings by working as a bag boy at a grocery store. Or that at age 12, he was forced to sell drugs in local crack houses to pay off his mother’s drug debts and was warned that she would be beaten if he didn’t. In other words, from the time he was a little boy, Gary Rhines never stood a chance.

Under the crime bills none of that mattered. All that mattered was that Mr. Rhines was a repeat offender. Most Americans had no patience for stories of abuse and deprivation, but judges still did, even if they couldn’t do anything about it.

Congress finally began to reel in some of its longest and most unjust sentences in 2010, when it passed the Fair Sentencing Act, which reduced a glaring disparity in punishments for crimes involving crack and powder cocaine. That should have been good news for inmates like Mr. Rhines, because under the new law, the amount of crack he was convicted of selling no longer triggered a mandatory life sentence. The problem was that the 2010 law applied only to future cases, not past ones.

This is where the First Step Act comes in. Signed last December by President Trump, it slashed the length of drug sentences — for example, the top mandatory-minimum punishment for a third-strike drug offense is now 25 years rather than life. The law also gave judges more power to reduce individual sentences and authorized $75 million in annual funding for prison programs that will help prepare inmates for release. Most important, it made the 2010 sentencing law retroactive, which helps the thousands of inmates, like Mr. Rhines , who have been serving absurdly long sentences under a law that Congress itself said was unjust nearly a decade ago.

At Mr. Rhines’s resentencing hearing in July, where he recounted his brutal childhood, Judge Jones noted the painfully slow evolution of America’s criminal-justice system. “It’s taken essentially a quarter century for policymakers to figure out the fundamental unfairness” of those harsh 1980s and 1990s drug laws, the judge said. He also noted that the trial judge in Mr. Rhines’s case, James McClure, had been frustrated at having his hands tied by the law. “That deprived Mr. Rhines of the determination of a very fair jurist,” Judge Jones said, “who carefully evaluated every case that came before him.” (Judge McClure died in 2010.)

Finally, Judge Jones took note of Mr. Rhines’s self-rehabilitation in an indifferent environment. “Without any hope,” the judge said, “you participated in a number of these programs, which is very impressive to me.”

“You’re asking me to take a leap of faith here, Mr. Rhines,” the judge added. “It’s a shorter leap because of what you’ve done and what you’ve accomplished.”