Good job, Jeff Sessions! It seems the attorney general's misguided attempts to revive the unpopular and unjust federal war on marijuana may be having the exact opposite effect -- prompting a new bipartisan effort in Congress to allow states to legalize cannabis.

Last week Sen. Cory Gardner (R-Colo.) and Sen. Elizabeth Warren (D-Mass) introduced a bill that would essentially end the federal prohibition in states that have chosen to permit medical or recreational marijuana under their own laws. In an unexpected boost for the bill, President Trump said he probably would support it.

The States Act, as it is known, would amend the Controlled Substances Act so that it would no longer be a crime for people to buy or sell marijuana, as long as they were following state laws. It also would extend the right to legalize marijuana to U.S. territories, federally recognized tribes and to Washington, D.C. -- where voters passed an initiative to allow adult recreational use of marijuana but Congress has blocked the district from permitting its sale.

This isn't the first bill in Congress proposing to ease federal restrictions on marijuana. It is, however, the first that has a chance of passing and the potential support of the president. It's the most promising effort to date to do away with the contradiction between federal law and the laws passed in recent years by California and other states to move marijuana sales from the black market into a legal, regulated and taxed system. That would be an extraordinary step forward.

And for this, we can thank Sessions.

In January, Sessions rescinded an Obama-era policy memo that outlined a hands-off approach to states that had legalized marijuana. The memo said federal law enforcement agencies should not interfere with states that allowed the commercial sale of marijuana as long as there are strict regulations in place.

Instead, Sessions said, federal prosecutors would have discretion to go after marijuana businesses. That has left the nascent legal market in a legal limbo, making it harder to move pot out of the shadows and into a controlled system.

For instance, it has stymied attempts to provide banking services to the cannabis industry. Because marijuana remains illegal under federal law, banks and financial services companies won't serve pot companies for fear of being penalized for handling money from drug sales. As a result, companies are forced to do business and pay their taxes in cash. That's dangerous, and it's bad public policy.

The States Act is designed to counteract the Sessions crackdown, letting states decide if they want to legalize marijuana or not without federal interference. The president did say on the campaign trail that legalization should be decided by the states. And it doesn't hurt that Trump is still mad at Sessions over the investigation into Russian interference in the 2016 election.

It would be ironic if Trump's irrational anger at the attorney general is what finally pushes the federal government to adopt a rational policy on marijuana. Whatever the motivation, Congress ought to take advantage of the moment.