Less than three years ago, Boris Johnson led the Conservatives to their biggest election victory since 1987.
Now, the prime minister has lost the support of his MPs and has resigned. How did it come to this?
The Chris Pincher affair
On Wednesday 29 June, the MP Chris Pincher - at the time, the Conservative deputy chief whip - went to a private members' club in London. In his words, he "drank far too much" and "embarrassed himself".
He was accused of groping two men, which led to flurry of allegations, some dating back years. It set off a chain of events that ended with the prime minister's downfall.
First, Downing Street said Mr Johnson was not aware of "specific allegations" about Mr Pincher before appointing him as deputy chief whip in February. Ministers later reiterated this line - even though it turned out to be inaccurate.
On 4 July, the BBC reported Mr Johnson had been aware of a formal complaint. The next day, a former civil servant - Lord McDonald - said the prime minister had been told of the complaint in person.
Mr Johnson then admitted he had been told in 2019, and apologised for appointing Mr Pincher as deputy chief whip.
In April this year, the prime minister was fined for breaking lockdown rules, after attending a gathering on his birthday in June 2020.
He also apologised for going to a "bring your own booze" party in the Downing Street garden during the first lockdown.
More widely, the Metropolitan Police issued 126 fines to 83 people for breaking lockdown rules in Downing Street and Whitehall.
And a report by Sue Gray - a senior civil servant - described a series of social events by political staff that broke lockdown rules.
"The senior leadership at the centre, both political and official, must bear responsibility for this culture," she wrote.
Last December, Mr Johnson told the Commons that "all guidance was followed completely in No 10". He is now being investigated by a Commons committee over whether he knowingly misled Parliament.
The cost of living crisis - and a tax rise
Inflation has risen sharply in 2022, to the current rate of 9.1%.
Many of the reasons were outside of Boris Johnson's control. Russia's invasion of Ukraine, for example, has led to rises in oil prices and the cost of food.
And, while the government has taken some steps - for example, by cutting fuel duty by 5p per litre - it also went ahead with a tax rise in April. National Insurance went up by 1.25 pence in the pound.
The government said the tax rise would pay for health and social care, and changes that kicked in this week softened the blow - but anyone earning more than £34,000 a year will still pay more.
"In the middle of the worst cost of living crisis for decades," said Labour leader Sir Keir Starmer in April, "the government chooses to increase taxes on working people".
Owen Paterson row
In October 2021, a House of Commons committee recommended a 30-day suspension for then-Conservative MP Owen Paterson.
The committee said he broke lobbying rules, to try to benefit companies who paid him.
But the Conservatives - led by the prime minister - voted to pause his suspension, and set up a new committee to look at how investigations were carried out.
After an outcry, Mr Paterson ended up resigning. Mr Johnson later admitted he had "crashed the car" in his handling of the case.
Lack of focus - and ideas
Boris Johnson won his thumping majority on the back of a clear, easy-to-follow policy - Get Brexit Done.
But since then, his critics said, there was a lack of focus and ideas in Downing Street.
His ex-adviser turned chief critic, Dominic Cummings, repeatedly accused him of being an out-of-control shopping trolley, veering from position to position.
Others questioned the prime minister's philosophy - or, indeed, if he had one. In June, Conservative MP and former minister Jeremy Hunt accused Mr Johnson of lacking "integrity, competence, and vision".
Mr Hunt was speaking before a confidence vote, which Mr Johnson won - but the complaints were getting louder.
The by-election defeats kept coming. After the latest, Mr Johnson said he would not undergo a "psychological transformation".
But that, now, is not the concern of Conservative MPs. They have spoken, and the prime minister is going.