SAN FRANCISCO (AP) — San Francisco’s district attorney says his office will toss out or reduce thousands of criminal convictions for marijuana dating back decades, which is allowed under a 2016 ballot measure legalizing recreational use in California.

District Attorney George Gascon announced Wednesday that his office will dismiss nearly 3,000 misdemeanor cases and review nearly 5,000 felony cases for possible action.

Proposition 64 legalized the recreational use of marijuana. It also allowed people convicted of marijuana charges to petition courts to toss out the cases or reduce penalties.

But Gascon says that process can be time consuming and costly, so prosecutors in the district attorney’s office plan to review and wipe out eligible cases en masse.

State lawmakers are considering a bill that would require all California district attorneys to take similar action.