Because marijuana is still illegal under federal law, those on supervised release who use the drug — or even refuse to be tested for it — are required to be sent back into custody. But in his order, Judge Weinstein said that locking people up again just for smoking pot — especially at a moment when laws and attitudes are changing — was not only a waste of time and money, but also had an implicit racial bias.

“In this court, the majority of supervisees who face a violation charge for marijuana use are African- Americans,” the judge explained. “Since an African-American is eight times more likely to be arrested for marijuana use, his or her chance of a supervised release violation for marijuana is much greater than a white person’s.”

Though Judge Weinstein said his new approach to supervised release would be carried out in all his future cases, his opinion was issued specifically in regard to Tyran Trotter, a 22-year-old Queens man who pleaded guilty in 2016 to distributing heroin. Mr. Trotter was sentenced in the case to two years in prison and to three years of supervised release.

Last year, after Mr. Trotter had served his time in prison, probation officials said he had violated the terms of his release by using marijuana and failing to comply with their orders to get treatment. The officials recommended that he be sent back to prison for another four months and be placed on two more years of supervised release.

But instead, Judge Weinstein refused to send Mr. Trotter back to prison and ended his stint of supervised release, essentially forgiving him of any violations. Mr. Trotter, the judge explained, had “stayed out of trouble” after being freed and was “trying to lead a productive life.” But he had a “chronic problem” that was getting in his way: an addiction to marijuana.