Theresa May will take over at 10 Downing Street today. Here's what the next prime minister will be facing as she begins to navigate a British exit from the European Union. (Adam Taylor,Jason Aldag/The Washington Post)

A chaotic, weeks-long leadership void in Britain ended abruptly Wednesday evening with Theresa May taking power as prime minister and immediately setting out her vision for a “bold” new role for the country even as it hurtles toward a potentially destabilizing exit from the European Union.

Minutes after curtsying before a handbag-toting queen at Buckingham Palace — the moment May formally ascended to the country’s highest political office — she told a nation still dizzy from developments since it voted to leave the European Union that Britain will prosper in its new incarnation, and become more fair and more equitable.

“As we leave the European Union, we will forge a bold, new, positive role for ourselves in the world, and we will make Britain a country that works not for a privileged few but for every one of us,” May said as she stood in front of 10 Downing Street for the first time as prime minister.

Later in the evening, she appointed a team-of-rivals cabinet, making good on a pledge to select “leave” and “remain” advocates for top jobs. Boris Johnson, a flamboyant, pro-Brexit former London mayor who had openly coveted the keys to 10 Downing Street before his ambitions were throttled by a friend, was named foreign secretary — making a man not known for his diplomatic niceties the nation’s top diplomat.

May’s first speech as prime minister marked a striking departure from the typical austerity-laden rhetoric of her Conservative Party. Instead of dwelling on the deficit, the country’s second-ever female prime minister emphasized the need to fight “burning injustice,” saying she will work on behalf of the poor, women and minorities.

The Post's Karla Adam snapped her way around Buckingham Palace and 10 Downing Street after Theresa May became Britain's next prime minister. (The Washington Post)

She also pledged to defend the “precious bond of the United Kingdom,” a nod to her determination to beat back a revitalized secessionist movement in Scotland driven by opposition to the decision to leave the European Union.

Her depiction of bright horizons for Britain outside the union contrasted with the gloomy forecasts from those who consider the referendum outcome a monumental mistake.

Only weeks ago, May was among them, having advocated that Britain remain in the European Union — the same stance taken by David Cameron, whom she replaced.

But while the referendum cost Cameron his job — he signed off Wednesday with a bravura performance in his final appearance in Parliament — it earned May the ultimate promotion. She has insisted that there will be no turning back on the country’s departure, and that “Brexit means Brexit.”

May, 59, heaped praise on Cameron on Wednesday, saying he had led the Tories — and the country — in the right direction by successfully campaigning to legalize same-sex marriage and modernizing what had been known as “the nasty party.”

But Cameron, 49, leaves his successor a mixed inheritance, with the most difficult questions surrounding Britain’s E.U. exit — popularly known as Brexit — still to come.

One of her first major decisions as prime minister will be to choose when to begin negotiations. Before winning the Conservative leadership contest, she had said that she would not trigger Article 50 — the never-before-used mechanism for exiting the European Union — before year’s end. But she is likely to come under pressure from European leaders across the English Channel and from Brexit advocates at home to move faster.

May secured the job Monday after her sole rival, Andrea Leadsom, unexpectedly dropped out. With only one candidate in the race, a planned summer-long vote of rank-and-file party members was called off.

May, the first female prime minister since Margaret Thatcher stepped down more than a quar­ter-century ago, takes over after six years directing the country’s domestic security as home affairs secretary.

In that notoriously career-killing job, she developed a reputation as a steely yet cautious manager. Supporters laud her resolve and her experience. Detractors depict her as stubborn and rigid.

May has been a hawk on the issue of reducing the number of immigrants entering Britain and pushed for a greater government role in electronic surveillance.

Her views on foreign and economic policy are less known. But in her first major speech on the economy this week, her tone was more liberal than expected — emphasizing the need to spur growth and close the gap between rich and poor.

On foreign policy, May has taken a hard line on containing Russia and China. She also has worked closely with colleagues across Europe and in Washington on counterterrorism.

Her point man for foreign policy will be Johnson, perhaps the most prominent face in the “leave” campaign and one widely derided for exaggerating the potential benefits of Brexit.

Johnson, once the front-runner for prime minister, could have some fence-mending to do with Washington: After President Obama came out against Brexit, Johnson suggested that the “par­­t-Kenyan” president may not have Britain’s interests at heart because of his anti-colonial outlook.

He also once described Hillary Clinton as having “a steely blue stare, like a sadistic nurse in a mental hospital.”

Whatever Johnson’s flaws, May overlooked them in a bid to heal a party that was nearly torn apart by the rift between its “leave” and “remain” camps. The strategy reflects the continued peril for Conservative prime ministers of the Europe issue: Cameron, Thatcher and John Major were all undone by Europe, and May appears determined not to follow their lead.

In addition to Johnson, May appointed another prominent “leave” advocate, former minister of state for Europe David Davis, to the new job of minister for Brexit — giving him a key role in the negotiations to come.

Top “remain” lieutenants will include Philip Hammond, who had been the foreign secretary and will now take over as the country’s top finance official, or chancellor of the exchequer. Another “remain” advocate, energy and climate change secretary Amber Rudd, was named to May’s old job, home secretary.

One rival who was left out in the reshuffle was George Osborne, formerly the chancellor of the exchequer and once considered Cameron’s hand-picked successor.

After all the turmoil in Britain in recent weeks, Wednesday’s hand­-over was accomplished with nearly military precision.

May was invited to govern the country during an audience with Queen Elizabeth II only minutes after Cameron visited Buckingham Palace and formally resigned. May became the 13th prime minister to air-kiss the hand of the queen, who at 90 has seen leaders of government come and go on average every five years during her more than six-decade reign.

For Cameron, Wednesday represents the disappointingly abrupt end to a premiership that has stretched six years — but was supposed to last as many as 10. Just a year ago, he won a resounding victory that could have kept him in office until 2020.

Amid gusting winds and bursts of rain, he stood Wednesday outside the prime minister’s residence and declared Britain “much stronger” than when he took office and he thanked the country for the “greatest honor of my life.”

Cameron, his wife, Samantha Cameron, and their three young children then paused for a family hug before walking off to their cars and the short ride down the Mall to Buckingham Palace.

When he had appeared on the green benches of Parliament earlier in the day, Cameron took jabs from opponents who blamed him for calling the E.U. vote. But he also received a rare standing ovation, and his premiership was celebrated by fellow Conservatives who congratulated him on cutting the deficit, enacting same-sex marriage and promoting women — one of whom took his place.

Customarily a gladiatorial-style grudge match, the weekly Prime Minister’s Questions was unusually lighthearted and poignant.

Standing two sword lengths from opposition leader Jeremy Corbyn, Cameron described the embattled Corbyn as “the Black Knight in ‘Monty Python,’ ” who loses limb after limb while insisting that “it’s only a flesh wound.”

The young-looking Cameron’s final line before leaving the chamber alluded to a barb he once directed at one of his predecessors, Tony Blair: “I was the future once.”

Karla Adam in London and Brian Murphy in Washington contributed to this report.