IN 2008, Edward Dorsey Sr. was charged in federal court with peddling 5.5 grams of crack cocaine. Mr. Dorsey eventually pleaded guilty but would have to wait two years before being sentenced. The delay seemed fortuitous for Mr. Dorsey: In 2010 the president signed into law the Fair Sentencing Act (FSA), which dramatically reduced the penalties for crack cocaine and eliminated mandatory minimum sentences for those caught with less than 28 grams of the drug.

The change brought some measure of sanity to draconian crack laws that often required inordinately long sentences for low-level and nonviolent offenders. Congress rightly acknowledged the unfair impact that such penalties had on young African American men — those most often charged with crack offenses — compared to the white or Hispanic defendants who were more often arrested for powder cocaine offenses and thus subject to far more lenient penalties.

Mr. Dorsey was not able to avail himself of the reduced penalties. Federal courts concluded that, because he was charged and convicted before the FSA took effect, he would have to be sentenced under the old scheme. Because of prior convictions, Mr. Dorsey was hit with a 10-year mandatory minimum sentence. His case and that of another defendant sentenced under the now-repudiated sentencing standards were heard by the Supreme Court on Tuesday.

Mr. Dorsey and hundreds of defendants such as him must contend with a legal provision that requires lawmakers to “expressly provide” for retroactive application of a new law. Congress did not make such a declaration when drafting the FSA.

Yet the Supreme Court has determined in other circumstances that explicit directives — or as it put it in one case, “magical passwords” — on retroactivity need not be present. In those cases, the justices factored in legislative history and the reading of the new law as a whole to determine Congress’s intent. “Fair” or “clear” implication of that intent, the justices have said, can sometimes be enough. In this case, Congress directed the U.S. Sentencing Commission to fast-track new guidelines so that they could be applied as soon as possible.

The legal precedents may, in the end, not favor Mr. Dorsey, but moral imperatives do. It is simply wrong to sentence a defendant to a penalty that Congress and the president have already determined is grossly unfair and racially discriminatory. Former federal judges Paul Cassell, a George W. Bush appointee, and Clinton nominee Nancy Gertner offered compelling insights about the damage to the justice system, should individuals continue to be imprisoned under the discredited rules. “Many Americans, particularly in minority communities, have come to regard the federal criminal justice system with suspicion because of the ill-founded crack/powder disparity,” they wrote in an amicus brief to the Supreme Court. “That harmful perception will continue and, indeed, be strengthened if this Court refuses to immediately apply Congress’s corrective action.”

If the justices conclude that the law demands Mr. Dorsey and others like him must be sentenced under the old regime, Congress should step in quickly to correct the problem.