Metropolitan Police Commissioner Dame Cressida Dick is leaving her role after a series of damaging controversies.
Dame Cressida said she had been left with “no choice” after London Mayor Sadiq Khan made it clear to her he had no confidence in her leadership.
Last week, the police watchdog found “disgraceful” misogyny, discrimination and sex harassment among some Met PCs.
Dame Cressida, the first woman to lead the biggest UK police force, also faced criticism over the Sarah Everard case.
Ms Everard was murdered by a serving Met Police officer, Wayne Couzens, in March last year.
Speaking on BBC London hours before her departure was announced, she insisted that she had “absolutely no intention” of quitting, and that she was “seething angry” about the culture at Charing Cross police station, which was exposed by the police watchdog.
In her resignation statement, Dame Cressida said she had “agreed to stay for a short period to ensure the stability of the Met”.
Her successor will be appointed by the home secretary, in consultation with the mayor of London. Contenders include Matt Jukes and Neil Basu, who are both assistant Met commissioners.
Beyond London, the Met is also responsible for national counter-terrorism policing.
Mr Khan said he was “not satisfied” with Dame Cressida’s response to the scale of change required to “root out” racism, sexism, homophobia, bullying and misogyny in the Met.
“On being informed of this, Dame Cressida Dick has said she will be standing aside,” he said.
Mr Khan thanked the commissioner for her 40-year policing career.
He said he would now “work closely with the home secretary on the appointment of a new commissioner” with an aim to restore trust in the force.
Prime Minister Boris Johnson said Dame Cressida “has served her country with great dedication and distinction over many decades”.
Home Secretary Priti Patel said the police chief held the role “during challenging times” and that she “exemplified the increasingly diverse nature of our police”.
Susan Hall, leader of the Greater London Assembly Conservatives, said Mr Khan had handled the situation “extremely badly”.
Earlier this week Mr Khan said he had put Dame Cressida “on notice” following the exposure of racist and sexist messages sent by officers at Charing Cross.
But Ms Hall told BBC Radio 4’s Today programme this should have been done “behind closed doors”.
She said the resignation made Londoners less safe and left a “void” at the top of the Met.
A decision taken for her
Analysis by Tom Symonds, home affairs correspondent
On Thursday morning she was adamant. She wasn’t going. But all the signs are that the decision was taken for her by Sadiq Khan.
The commissioner of the Metropolitan Police is appointed by the Queen, on the advice of the home secretary, but the commissioner cannot do the job without the support of the mayor.
In the last few weeks attempts were made to convince him that the Met’s plan would deliver change.
But that plan involved a review – by Dame Louise Casey – that would have taken much of the year.
She had been given the power to roam freely through the force looking for bad attitudes and poor management of disciplinary issues.
That would have been a period when more revelations were inevitably going to emerge making the commissioner’s position even more difficult.
The mayor’s timetable was different – days, weeks at most. He needed to be convinced. His officials didn’t sound it on Wednesday. Thursday night’s development is the result.
Dame Cressida, who served in the role for almost five years and was recently given a two-year contract extension, said in a statement: “It is with huge sadness that following contact with the mayor of London today, it is clear that the mayor no longer has sufficient confidence in my leadership to continue.
“He has left me no choice but to step aside as commissioner of the Metropolitan Police Service.”
“The murder of Sarah Everard and many other awful cases recently have, I know, damaged confidence in this fantastic police service,” she added.
“There is much to do – and I know that the Met has turned its full attention to rebuilding public trust and confidence. For that reason I am very optimistic about the future for the Met and for London.”
The Met had submitted a plan to Mr Khan last Friday on reforming the force and a meeting was due to be held on Thursday afternoon.
A City Hall source said Mr Khan made it clear through his officials – but not directly to the commissioner – that the plan was not going to work and the meeting was cancelled.
Harvey Proctor, a former MP falsely accused of murder during a disastrous probe into claims of a VIP paedophile ring, said her departure had come not a “day too soon” and called for a full inquiry into all her “personal mistakes”.
The partner of a man who was murdered by serial killer Stephen Port said the resignation was “about time” and that Dame Cressida was not capable of dealing with the homophobia, sexism and racism within the Met.
Ricky Waumsley previously called for her to quit after an inquest jury found police failures had likely contributed to the death of his partner Daniel Whitworth and two more of Port’s victims.
Shadow home secretary Yvette Cooper thanked Dame Cressida for her public service and said reform was needed to rebuild public confidence after recent cases.
Lib Dem leader Sir Ed Davey said a change in the force’s leadership was “long overdue”.
He added that Mr Johnson, whose part in the Downing Street parties held during lockdown is still being investigated by the Met, must have no role in choosing her successor.
But Ken Marsh, the chairman of the Metropolitan Police Federation, which represents rank and file officers in London, said Dame Cressida had been unfairly treated.
“We feel the way she has been treated is wholly unfair and we did believe that she was the person who could take us through this and bring us out the other side,” he said.
In 2008, the then-Met Commissioner Sir Ian Blair stood down after he lost the support of the London mayor at the time, Boris Johnson.