WASHINGTON — The House on Friday passed sweeping legislation that would decriminalize marijuana and expunge nonviolent marijuana-related convictions, as Democrats sought to roll back and compensate for decades of drug policies that have disproportionately affected low-income communities of color.The 228-164 vote to approve the measure was bipartisan, and it was the first time either a chamber of Congress had ever endorsed the legalization of cannabis. The bill would remove the drug from the Controlled Substances Act and authorize a 5 percent tax on marijuana that would fund community and small business grant programs to help those most impacted by the criminalization of marijuana.The legislation is, for now, almost certainly doomed in the Republican-led Senate, where that party’s leaders have derided it as a superficial distraction from the work of passing coronavirus relief, as lawmakers inched toward bipartisan compromise after spending months locked in an impasse.But the bill’s passage in the House amounted to a watershed moment decades in the making for advocates of marijuana legislation, and it laid out an expansive federal framework for redressing the racial disparities in the criminal justice system exacerbated by the war on drugs.“The effects of marijuana prohibition have been particularly felt by communities of color because it has meant that people from the communities couldn’t get jobs,” Representative Jerry Nadler, Democrat of New York and the chairman of the Judiciary Committee, said in an interview.Mr. Nadler, who spearheaded the legislation with Senator Kamala Harris, Democrat of California and the vice president-elect, described the collateral consequences of a conviction for marijuana possession as creating “an often-permanent second-class status for millions of Americans.”The idea behind the legislation is “you want to make whole these communities, and you want to compensate,” he said. “You want to shed light on what was done.”The legislation intends to give states power and incentives to enact their own reforms, and its passage came as states around the county, including some conservative-leaning ones, have become increasingly open to decriminalizing marijuana amid a growing consensus that the war on drugs has been destructive. Fifteen states have legalized recreational cannabis, and voters in five states last month voted on legalization issues, bringing the number of states where medical marijuana is legal to 35.The law would require federal courts to release those serving sentences for nonviolent, marijuana-related offenses, and set up grant programs focused on providing job training, legal aid and substance use treatment, as well as grants for small businesses in the marijuana industry led by low-income and minority business owners. Physicians with the Department of Veterans Affairs would also be allowed for the first time to recommend medical marijuana to their patients.It is the first major piece of legislation aimed at addressing racial disparities in the criminal justice system that Congress has taken up since June, when the House, responding to a national outcry for racial justice, passed a behemoth policing overhaul bill, which ultimately was stalled by partisan disagreement. To date, Congress has yet to send any legislation to the president’s desk addressing the issue since nationwide protests last summer.“This is part of the same effort to make it possible for minority communities to live on an equal basis in this country,” Mr. Nadler said.Republicans denounced the bill, and castigated Democrats for bringing it to the floor before lawmakers had struck a compromise on coronavirus relief. Democrats had postponed a vote on the legislation scheduled earlier in the fall after some moderate lawmakers facing difficult re-election races fretted about fending off those attacks, during a campaign in which Republicans accused them of backing a radical liberal agenda.“With mere days left in the year to get something done for the American people who are suffering, Speaker Pelosi has brought up a drug legalization bill,” said Representative Pete Stauber, Republican of Minnesota. “As children struggle to receive their education and child care facilities close; as seniors remain isolated from their families, this is their solution.”A few Republicans broke from their party to support the bill — but even those who did were vocal in airing their complaints.“If Pelosi was serious about marijuana reform we would take a vote on the STATES Act, which would pass the Senate and be signed into law,” Representative Matt Gaetz, Republican of Florida, said, referencing a bipartisan bill introduced in the Senate that would legalize marijuana. “But she isn’t. So we’ll do this instead.”Mr. Gaetz added: “I prefer my marijuana reform not dipped in reparations policy, frankly.”For Democrats, that was exactly the point.Forty percent of drug arrests made in 2018 were for marijuana offenses — and just over 90 percent of those arrests were for possessing the drug, according to a report from the nonpartisan Pew Research Center. A separate report released by the American Civil Liberties Union showed that Black people are more than three times as likely as white people to be arrested for marijuana possession despite comparable usage rates.“Marijuana use is either socially acceptable behavior or it’s criminal conduct,” said Representative Hakeem Jeffries, Democrat of New York. “But it can’t be socially acceptable behavior in some neighborhoods and criminal conduct in other neighborhoods when the dividing line is race.”Nicholas Fandos contributed reporting.