Boris Johnson has won the contest to replace Theresa May as leader of Britain’s Conservative Party and U.K. Prime Minister, party officials announced Tuesday morning.

He beat his rival, Foreign Secretary Jeremy Hunt, winning 66.4% of votes cast by members of the ruling Conservative Party.

“I will work flat out,” Johnson said in his victory speech. “The campaign is over and the work begins.”

President Trump congratulated Johnson after the results were announced. “He will be great!” the President tweeted.

Johnson will be formally sworn in as Britain’s 77th Prime Minister on Wednesday, after May travels to Buckingham Palace to meet the Queen.

A former Mayor of London and Foreign Secretary, Johnson was a leading figure in the campaign to leave the E.U. in Britain’s 2016 Brexit referendum. He had been the favorite in the contest to replace May, and takes office just three months before Britain is scheduled to leave the European Union, on Oct. 31. He now faces the immediate task of negotiating a new exit deal, but says Britain will leave on that date, “do or die.”

Lawmakers had previously rejected the deal May had struck with the E.U. after two years of negotiations, leading to her resignation in June as head of the Conservative Party. In the campaign to replace her, Johnson repeatedly said he would keep a “no deal” Brexit (leaving the bloc with no arrangements for continued trade and regulatory harmony) on the table. That approach enraged some members of May’s cabinet, including the Chancellor (Britain’s equivalent to a Finance Minister) Philip Hammond, who is widely tipped to resign on Tuesday before he is fired by Johnson.

Johnson’s first challenge will be to rally lawmakers behind his leadership. His ruling Conservative Party has a wafer-thin majority, and just a few party colleagues voting against his government could force a vote of no confidence.

If he loses a vote of no confidence, the U.K. could be forced to hold a new general election. If Johnson passes that hurdle unscathed, his next task will be to attempt a renegotiation of May’s Brexit deal with steely E.U. officials.

Universally known in Westminster as “Boris,” Johnson is a polarizing figure in British politics. He began his career as a journalist in Brussels, reporting during the 1990s on the E.U. headquarters for the Daily Telegraph newspaper, from where he would regularly send critical — and sometimes factually sparse — dispatches back to London.

His work there, former colleagues tell TIME, laid the foundation for Brexit. “He played into the image of the E.U. as a continental club where Britain was going to lose its influence, and where it would be held to hundreds of absurd regulations like straight cucumbers and bananas, or the E.U. having a standard size for condoms,” says Michael Binyon, who served as the Times of London’s Brussels correspondent at the same time as Johnson. “It made people laugh, but helped create a climate of hostility to ‘Brussels bureaucrats.’”

Johnson was close to former Prime Minister David Cameron — they had been members of the same elite all-male dining society at Oxford University — and in 2001, he was handed a safe Conservative parliamentary seat. In 2008, having cultivated popular appeal by appearing regularly on comedy panel shows, he became Mayor of London. “As Mayor he did pretty well because he didn’t have a lot of executive responsibility,” Binyon says. The role was perfect for his exuberant personality.

During the 2016 Brexit referendum, Johnson enraged Cameron by deciding to campaign on the opposite side. He became a leading figure in the official “Vote Leave” campaign, building on his work as a journalist in Brussels, telling voters the E.U. was a club of “Brussels bureaucrats” impinging on British democracy. His side won, and after trying and failing to become Prime Minister in 2016, he was installed as Foreign Secretary in May’s government.

As Prime Minister, Johnson will have far more responsibilities than he did in that role — for which he is largely remembered for a series of gaffes, including reciting a colonial-era poem at an event in Myanmar, and erroneously saying that British-Iranian citizen Nazanin Zaghari-Ratcliffe, held captive in Iran, had been training journalists during her visit to the country, which critics said gave the Iranian regime further reason to keep her imprisoned.

“There will be a lot of focus on whether he can back up the rhetoric,” says a senior diplomat who worked with Johnson when he was Foreign Secretary. “We saw a lot of energy and panache in the Foreign Office. But also a very short attention span. If he’s going to be a successful Prime Minister, he will need to step up to a new level.”

Write to Billy Perrigo at billy.perrigo@time.com.