San Francisco District Attorney George Gascón announced Thursday he is resigning from office before his term concludes at the end of the year and moving to Los Angeles, where he’s exploring a run for the top prosecutor job.

In an email to his staff, Gascón said he is resigning effective Oct. 18 — less than three weeks before San Francisco voters decide his successor. Gascón tapped his chief of staff, Cristine Soto DeBerry, to assume his duties when he leaves office.

“I am truly grateful for your support and confidence all these years,” Gascón wrote in the email obtained by The Chronicle. “You stood by me when I asked you to look past what the criminal justice system has always been, and to consider instead what justice could be.”

Mayor London Breed can immediately name a replacement, or she could wait until after the Nov. 5 election and appoint the district attorney-elect to begin serving Gascón’s remaining 2½ months in office.

Breed has already endorsed Suzy Loftus in the district attorney’s race, and appointing her candidate to the high-profile position before voters pick a winner would undoubtedly draw controversy. It also wouldn’t be the first time the mayor appointed a candidate she endorsed to an open seat weeks before an election.

Last year, Breed appointed Faauuga Moliga — the candidate she endorsed — to a vacant seat on the San Francisco Board of Education, just three weeks before election day. Moliga ultimately won the seat, and many accused the mayor of putting her thumb on the election scale.

In a statement shortly after Gascón’s announcement, Breed signaled she may appoint someone to the office before the election. She did not mention any names.

“People depend on the district attorney to keep our residents and communities safe each and every day,” the mayor said in the statement. “We can’t afford to have an absence of leadership in the DA’s office because victims of crime need to be represented and people who commit crimes in our city need to be held accountable.”

Gascón hasn’t announced plans to run in Los Angeles, but he previously told The Chronicle he is strongly considering it. The filing deadline for the March 3 primary in Los Angeles is Dec. 6. To run, Gascón must establish residency in Los Angeles.

Gascón’s decision to resign and move south comes just days after an independent expenditure committee started the “Run George Run” campaign with a billboard outside incumbent Los Angeles District Attorney Jackie Lacey’s office. The committee comprises members of the national criminal justice reform community and has already raised “six-figures-plus” to back Gascón, the group’s strategist, Dan Newman, told The Chronicle.

Gascón established himself as one of the country’s most progressive district attorneys during his eight years in office. Activist groups have been pushing him for months to run in Los Angeles, where he began his law enforcement career in the city’s Police Department more than four decades ago. Los Angeles County has the largest district attorney’s office and jail system in the country and is viewed as a crucial battleground in the national criminal justice reform movement.

Similar efforts to elect reform-minded prosecutors have succeeded in Philadelphia, Chicago and Houston as voters have increasingly bucked the “tough on crime” strategies of the 1980s and 1990s that led to mass incarceration.

“The criminal justice reform movement in L.A. and across the nation is energized and united in urging D.A. Gascón to return home to the nation’s largest county and fix its broken criminal justice system,” said Anne Irwin, founder and director of Smart Justice California, a group working to reform the state’s justice system.

Activist groups have challenged Lacey’s record and criticized her for what they see as a regressive record. A report by the American Civil Liberties Union found that Lacey’s office obtained death sentences for 22 defendants, all of whom were people of color. Gascón has never sought the death penalty.

Lacey’s team has defended her record, noting her work on mental illness and her conviction review unit. She’s also racked up a list of major endorsements, including Los Angeles Mayor Eric Garcetti and Rep. Adam Schiff, D-Burbank, the head of the House Intelligence Committee, which is leading the impeachment inquiry into President Trump.

Lacey is the first woman and first African American to hold the office.

“I’m proud of my progressive record as district attorney — from creating a pathway for nonviolent offenders to get treated for mental illness instead of thrown in jail, to advocating for a ban on private prisons and an end to cash bail, to expunging thousands of nonviolent marijuana-related arrests, to aggressively prosecuting sex traffickers who exploit women and children,” Lacey said in a statement to The Chronicle last week.

If he runs, Gascón would join a growing field of candidates to challenge Lacey, including Los Angeles County Deputy District Attorney Joseph Iniguez, who’s already running on a progressive platform.

Gascón joined the Los Angeles Police Department in 1978 and rose to the rank of assistant chief. He later became police chief in Mesa, Ariz., and was tapped by former mayor and now Gov. Gavin Newson to be San Francisco’s police chief in 2009. Newsom appointed him district attorney in 2011 after Kamala Harris left to serve as California’s attorney general.

Last year, Gascón announced that he would not seek re-election in San Francisco, citing his 90-year-old mother’s ailing health. The job in Los Angeles would put him closer to her.

During his two terms as district attorney in San Francisco, Gascón has pushed several progressive reforms on the state and local level.

He sponsored the controversial Proposition 47 in 2014, which reduced some felonies to misdemeanors for certain drug and property crimes and helped thin the state’s notoriously overcrowded prisons. The measure, along with his support of realignment and Prop. 57, which limited how minors could be transferred to adult court, have been praised by reform groups. AB109, generally referred to as realignment, kept some offenders in local jails rather than being sent to state prison.

In San Francisco, Gascón recently began a program to expunge marijuana convictions after state voters passed Prop. 64 to legalize cannabis for personal use. And in June, his office began using a blind charging tool that removes a suspect’s racial information from police reports when prosecutors decide on charges.

But while Gascón has been a local and national reform leader, he has faced strong criticism from both conservatives and local activists. Law enforcement groups, including the San Francisco police union, have blamed Prop. 47, Prop. 57 and realignment for a rise in property crimes.

“We are praying for the residents of Los Angeles, hoping that George Gascón does not do to their city what he did to San Francisco during his tenure: double-digit increases in crime, author of Proposition 47 that created our criminal justice revolving door, cars broken into by the thousands and neighborhoods ravaged by open air drug markets and crime,” Tony Montoya, president of the San Francisco Police Officers Association, said in a statement.

Violent crime rates actually dropped significantly during Gascón’s time in San Francisco, but property crimes — driven mostly by the city’s auto burglary epidemic — increased in recent years.

During his tenure, Gascón also outraged local activists with his decisions not to charge officers in high-profile police-involved killings, most notably the 2015 shooting of Mario Woods in the city’s Bayview.

Meanwhile, Loftus and fellow candidates Chesa Boudin, Leif Dautch and Nancy Tung are coming down to the home stretch in San Francisco’s first open race for district attorney in more than a century.

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