A bill that decriminalizes marijuana at the federal level has passed the US House.

Lawmakers approved a bill Friday that would allow states to set their own policies on marijuana. 

The House approved the bill with a mostly party-line vote of 220-204. All but two voting Democrats backed the measure, while only three Republicans did.

While the vote is unlikely to secure enough votes in the Senate to become law, Friday's vote gave lawmakers a chance to show support for the legalization trend that is spreading quickly across the country.

The bill would allow the federal government to impose an 8% tax on cannabis products, allow some convictions on marijuana charges to be expunged and could even press for sentencing reviews.

Thirty-seven states and District of Columbia allow the medical use of cannabis products while 18 states and the District of Columbia allow for recreational marijuana.

Democrats said the federal prohibition on marijuana has had particularly devastating consequences for minority communities. Republicans mostly opposed the bill and called it a distraction from more pressing issues. They said decriminalization is not the priority that lawmakers should be focused on now, with the war in Ukraine and inflation driving up the cost of gas, food and other essential items.