LONDON (AP) — Liz Truss, a onetime accountant who has served in Parliament for the past 12 years, will become Britain’s prime minister on Tuesday when Queen Elizabeth II formally asks her to form a government.

The ceremony, which will take place at a royal residence in Scotland, follows a bruising two-month contest to succeed Boris Johnson, who will formally offer his resignation to the queen shortly before Truss arrives to take up the mantle.

The handover of power is governed by rules and traditions built up over the centuries, as the U.K. evolved from an absolute monarchy to a modern parliamentary democracy where the sovereign plays an important but largely ceremonial role as head of state.

Here is a brief description of Tuesday’s events and how Britain arrived at this point.

HOW DID LIZ TRUSS BECOME PRIME MINISTER?

Boris Johnson announced his intention to step down as prime minister and leader of the ruling Conservative Party on July 7, after dozens of Cabinet ministers and lower-level officials resigned following months of scandal and growing concern that he could no longer deliver election victories.

Because Johnson’s government didn’t lose a vote of confidence, the Conservatives still command a majority in the House of Commons and so a general election wasn’t required to select a new prime minister. Instead, it was up to the Conservatives to pick a new leader who would automatically become prime minister as the leader of the majority party.

Truss and former Treasury chief Rishi Sunak squared off in the internal contest to become Conservative Party leader, holding campaign events around the country as they vied for support among 172,000 dues-paying party members. Truss was announced as the winner of that contest on Monday after she received 57% of the vote.

WHY IS THE QUEEN INVOLVED?

As head of state, the queen still formally appoints the prime minister, though the decision is now based on constitutional conventions. When one party holds a majority in the House of Commons, as is the current situation, the prime minister is always the leader of that party.

But the queen maintains a special relationship with her prime ministers, holding regular meetings with them throughout their time in office.

While the queen is constitutionally required to remain strictly neutral on all political matters, she is entitled to be informed and consulted about government policy. And she retains the right to “advise, encourage and warn ministers,” according to the official guide to the laws, rules and conventions of government.

WHY DIDN’T TRUSS IMMEDIATELY BECOME PRIME MINISTER?

First of all, because Johnson is technically still prime minister. While Johnson announced his intention to step down on July 7, prime ministers usually don’t formally resign until it is clear who their successor will be.

Now that Truss has been elected Conservative Party leader, Johnson is due to resign on Tuesday.

WHY IS EVERYONE IN SCOTLAND FOR THE CEREMONY?

Normally, the new prime minister travels the short distance from the Houses of Parliament to Buckingham Palace to meet with the queen. But this year, the 96-year-old sovereign is at Balmoral, her retreat in Aberdeenshire, Scotland, for her annual vacation.

Elizabeth has had difficulties moving around of late and decisions about her schedule are being made on a daily basis depending on what she feels up to. So rather than take the chance that she wouldn’t be ready to travel to London on Tuesday, planners injected a bit of certainty into the diary by asking the new leader to come to her.

WHAT WILL ACTUALLY HAPPEN ON TUESDAY?

Things kicked off at about 7:30 a.m., when Johnson appeared outside the prime minister’s official Downing Street residence to deliver a farewell speech before flying to Scotland. He is scheduled to meet the queen later in the morning to formally offer his resignation.

Truss, who is expected to make the 500-mile (800-kilometer) journey on a separate plane, is due to arrive at Balmoral just after noon for a 30-minute audience with the queen where she will formally be asked to form a new government.

Truss will then return to London, where she is expected to address the nation later in the afternoon.