By Luis Ferré-Sadurní / The New York Times

After years of stalled attempts, New York State has legalized the use of recreational marijuana, enacting a robust program that will reinvest millions of dollars of tax revenues from cannabis in minority communities ravaged by the decades-long war on drugs.

Gov. Andrew M. Cuomo signed the cannabis legislation on Wednesday, a day after the State Legislature passed the bill following hours of debate among lawmakers in Albany.

New York became the 15th state to legalize the recreational use of cannabis, positioning itself to quickly become one of the largest markets of legal cannabis in the nation and one of the few states where legalization is directly tied to economic and racial equity.

Previous attempts to legalize marijuana were stymied over disagreements on how the tax revenue from sales would be distributed. Democratic lawmakers, especially those who are nonwhite, insisted that a large portion of the money be earmarked for communities where Black and Latino people have been arrested on marijuana charges in disproportionate numbers; the governor wanted to retain more control over how the money was spent.

The lawmakers prevailed. Forty percent of the tax revenue from pot sales will be steered to those communities, and people convicted of marijuana-related offenses that are no longer criminalized will have their records automatically expunged. The law also seeks to allow people with past convictions and those involved in the illicit cannabis market to participate in the new legal market.