The city of San Francisco plans to retroactively apply California’s current marijuana legalization laws to past criminal cases dating back decades, the district attorney’s office announced Wednesday.

The new policy will apply Proposition 64 to nearly 5,000 felony marijuana convictions and more than 3,000 misdemeanors dating as far back as 1975, District Attorney George Gascón said.

WITH NEW YEAR, CALIFORNIA'S RECREATIONAL POT LAWS TAKE EFFECT

“While drug policy on the federal level is going backwards, San Francisco is once again taking the lead to undo the damage that this country’s disastrous, failed drug war has had on our nation and on communities of color in particular,” the district attorney said of the plan.

The thousands of felony convictions in the state for pot use will be reviewed, recalled and resentenced, and the misdemeanors will be dismissed and sealed, Gascón said.

While California was the first state to allow marijuana use for medicinal purposes, Proposition 64 — which became law in 2016 and allowed for legal pot sales in 2018 — allows adults 21 or older to legally use and grow cannabis, in addition to possessing up to one ounce of it.

SESSIONS' PLANNED MARIJUANA CRACKDOWN DRAWS FIRE FROM POLITICIANS, GROWERS

Criminal convictions “can be a barrier to employment, housing and other benefits,” Gascón said.

California Lt. Gov. Gavin Newsom said he hopes the policy will help alleviate the burden of the convictions to “primarily people of color, whose lives were long ago derailed by a costly, broken and racially discriminatory system.”

More than two million people were arrested in California between 1915 and 2016 for marijuana, but, according to the DA’s office, only 4,885 residents have filed petitions to have their convictions reduced or removed.