Photo: Gabrielle Lurie / Special To The Chronicle Photo: Photos By Liz Hafalia / The Chronicle Photo: Liz Hafalia, The Chronicle Photo: Liz Hafalia / The Chronicle

San Francisco District Attorney George Gascón announced Monday that his office will wipe out more than 9,000 marijuana-related convictions in an unprecedented step following California’s cannabis legalization more than two years ago.

Gascón last year teamed up with Code for America — a nonprofit focused on using open-source technology to improve government — to find every marijuana case eligible for expungement or resentencing under Proposition 64. San Francisco will be the first city in the country to clear all eligible pot convictions.

On Monday, the district attorney’s office said it has identified 9,362 eligible cases dating back to 1975. Gascón will present the cases to a judge in the coming weeks for expungement.

Numerous studies show that marijuana convictions disproportionately affect the poor and people of color, and can limit access to federal housing and loans. A 2013 study by the American Civil Liberties Union found that African Americans in San Francisco were more than four times as likely to be arrested for marijuana possession as white people.

Before Gascón announced plans to wipe out eligible marijuana cases, only 23 people had come forward to petition to have their cases reclassified or expunged. People with prior convictions needed to hire an attorney, and the process was complicated and time-consuming, Gascón said.

“It’s incumbent that we, as law enforcement leaders, continue to evolve how we advance fairness and public safety in our respective communities,” Gascón said. “I hope that our success with Code for America can act as a catalyst for other leaders looking to engage in similar innovative and out-of-the-box methods to reform and rethink what our criminal justice system looks like.”

Gascón announced the partnership with Code for America in May, when he said he expected to have all cases identified in about a year. On Monday, he said the work came in ahead of schedule and under budget.

Prop. 64, which voters passed in November 2016, legalized recreational marijuana in California for adults 21 and older, and it allows convictions to be expunged.

Code for America used its “Clear My Record” technology — a computer-based algorithm — to parse cases and determine which were eligible under Prop. 64.

“Contact with the criminal justice system should not be a life sentence, so we’ve been working to reimagine the record-clearance process,” said Jennifer Pahlka, Code for America’s founder and executive director. “This new approach, which is both innovative and common sense, changes the scale and speed of justice.”

San Francisco was the first jurisdiction in the country to announce it would clear old marijuana convictions, prompting other district attorneys across the state and country to begin similar work.

Gascón said he also wants to use Code for America’s technology to identify other types of cases that may be eligible for expungement.

Thousands of cases under recent criminal justice reforms like Proposition 47, which reduced many drug crimes and theft cases from felonies to misdemeanors, are eligible for reclassification or expungement. Much as with marijuana conviction, though, few people come forward to have their cases changed.

“What we have shown with marijuana is that this can be done en masse,” Gascón said. “You can just go through the criminal records of thousands of people and provide the relief that they qualify for without having to have a lot of human resources invested in it.”

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky