LONDON - Three years ago, Mr Boris Johnson led Britain's Conservative Party to its biggest election victory in decades.
Six years ago, Ms Liz Truss was an important Conservative voice in the unsuccessful campaign for Britain to remain part of the European Union.
But on Tuesday, Mr Johnson will step down, forced out by his own party. And Ms Truss will replace him, after winning over the party's right as a Brexit-championing foreign secretary.
Here's a guide to what changed, and to the sometimes arcane system by which Britain chooses a new prime minister:
In Britain's parliamentary system, the majority party's leader is PM
It is hard to get rid of a British prime minister, but far from impossible. The job goes to the leader of the political party with a parliamentary majority. The party can oust its leader and choose another one, changing prime ministers without a general election.
Three of Britain's last four prime ministers, including Mr Johnson, came into office between elections. The new prime minister may then choose to face the voters - in 2019, Mr Johnson did so within months - but there is no obligation to call a new general election until five years after the last one.
Johnson's party forced him to step down
Mr Johnson's position started to weaken late last year, with a series of scandals involving parties during Britain's coronavirus lockdown that eventually brought him a fine and a stinging official report. In June, he survived a no-confidence vote among his party's lawmakers.
The next month, however, brought a new scandal, with the departure of Mr Chris Pincher, a deputy chief whip, who was responsible for keeping Conservative lawmakers in line.
Mr Johnson had placed him in the job despite accusations of inappropriate behaviour. Ministers and other officials denied on Mr Johnson's behalf that he had been aware of those accusations, only for successive accounts to rapidly unravel.
On the evening of July 5, the chancellor of the Exchequer, Mr Rishi Sunak, resigned, alongside another top minister, Mr Sajid Javid, the health secretary.
A flood of further resignations followed, with more than 50 members of Parliament quitting Cabinet roles or other official positions by July 7, including some appointed to replace those who had already resigned.
Later that day, Mr Johnson announced that he would resign, acknowledging in a speech that it was clearly "the will of the parliamentary Conservative Party" that he step aside.
MPs set the terms of the contest to replace Johnson
When Mr Johnson resigned as leader of his party on July 7, he said he would remain as prime minister until the Conservatives had chosen a new leader. His two most recent predecessors, David Cameron and Theresa May, both took that approach when they resigned.
But the timetable for the leadership contest was not in Mr Johnson's hands: It was set by backbench Conservative lawmakers through a body called the 1922 Committee.
The broad outlines of the two-stage process remain constant. First, Conservative lawmakers hold a series of ballots among themselves to whittle the number of contenders down to two.
Then there's a ballot on the final choice among the party's entire dues-paying membership. These are members of the public who pay a standard annual subscription of £25 (S$40) and there are about 160,000 of them.
Eleven lawmakers sought to run this time, with the final two - Sunak and Truss - emerging on July 20 after five rounds of voting.
Party members questioned Mr Sunak and Ms Truss at a series of meetings around Britain over the summer. Voting, by mail and online, opened in early August and closed on Friday.
With the result announced on Monday, Mr Johnson and Ms Truss will travel on Tuesday to meet the queen at Balmoral Castle in Scotland for a formal handover of the role.
Truss is then expected to give a first big speech as prime minister outside her new home in Downing Street later that day.
Sunak, the lawmakers' top pick, struggled with party members
Through all five rounds of voting by lawmakers, one candidate remained in the lead: Mr Sunak, the top finance official for most of Mr Johnson's time in Downing Street.
Mr Sunak, 42, would have been Britain's first prime minister of colour - although there was a premier with Jewish heritage, Benjamin Disraeli, as long ago as 1868. For some time, Sunak was considered a favourite to take the job.
Party members, however, rejected him decisively.
Mr Sunak took up his post as chancellor in 2020, as the coronavirus was reaching Britain, and he gained popularity through his calm handling of its economic impact as it became a pandemic, including through a furlough program that paid companies to sustain nearly 12 million jobs during lockdown.
But this year, he had a fall from grace of his own. Like Mr Johnson, he was fined for attending a party that broke coronavirus regulations, and he has also faced damaging reports around the tax status of his wealthy wife.
Opponents have drawn attention to Mr Sunak's wealth, with one Cabinet minister pointing to reports that one of his suits cost £3,500, adding that Ms Truss wore earrings that cost £4.50.
In the final vote, he suffered from his association with Covid-era spending, tax increases and Britain's cost-of-living crisis, as well as his part in pushing out Mr Johnson, an ousting that many party members now say they regret.
Truss won over the party's right, despite a centrist past
Ms Truss, who was the foreign secretary, remained in the government during the wave of resignations that felled Mr Johnson. She took second place only in the final round of the lawmakers' ballot, consolidating support from several defeated candidates on the party's right.
Once a student activist for a smaller, centrist party, the Liberal Democrats, Ms Truss, 47, campaigned for Britain to remain in the European Union during the 2016 Brexit referendum - a key dividing line for the many Conservative members who, like Mr Sunak, voted to leave.
But she has remade herself as a champion of Brexit causes, pursuing aggressive negotiations with the European Union over trade in Northern Ireland. In this contest, she has also promised to pursue rapid tax cuts, to be financed by repaying pandemic debt over a longer period.
That was a point of distinction with Mr Sunak, who described the idea as "fantasy economics".
She also expressed scepticism about "handouts" to help voters with a coming sharp rise in energy bills - a stance she has since reversed, promising in a BBC interview on Sunday that she would set out a plan on the issue in her first week as prime minister - and pushed back against the idea of a windfall tax on energy companies.
Those positions appear to have resonated with Conservative members: Polling suggests she has established a clear lead in the contest, although her reputation among voters as a whole appears less secure.
She has up to two years, with a tricky road ahead
Although new prime ministers in Britain generally enjoy a lift in opinion polling, things look sticky for Ms Truss' government. Inflation is surging, interest rates have risen and household bills are soaring, with another hefty step up in domestic energy prices scheduled for October.
But she will also have one of the most significant advantages enjoyed by governing parties in British politics: the ability to set the date of a general election.
The last available moment would be January 2025. Going much sooner is an option, to capitalise on early popularity and pre-empt further bad news, but it would be a dangerous one.
Mr Johnson's snap election produced a landslide victory, but Mrs May, his predecessor, called an early election with a double-digit poll lead, only to lose both her parliamentary majority and her authority.
And the circumstances are far less favourable now. The Conservatives are consistently behind the opposition Labour Party in most opinion polling, and responses to pollsters' hypothetical questions suggest that neither leadership candidate would make a drastic difference.
Labour, however, has lost previous elections after holding similar or larger midterm leads.
If Ms Truss can navigate the choppy economic waters ahead, it could still be a fair few years before Britain has yet another prime minister. NYTIMES