A federal judge in Brooklyn, in an extraordinary opinion issued on Wednesday that calls for courts to pay closer attention to how felony convictions affect people’s lives, sentenced a woman in a drug case to probation rather than prison, saying the collateral consequences she would face as a felon were punishment enough.

The judge, Frederic Block of Federal District Court, said such consequences served “no useful function other than to further punish criminal defendants after they have completed their court-imposed sentences.”

The judge noted that there were nearly 50,000 federal and state statutes and regulations that imposed penalties on felons.

Those penalties — denial of government benefits, ineligibility for public housing, suspension of student loans, revocation or suspension of driver’s licenses — can have devastating effects, he wrote, adding that they may be “particularly disruptive to an ex-convict’s efforts at rehabilitation and reintegration into society.”