British Prime Minister Theresa May will form a government supported by a small Northern Irish party after her Conservative Party lost its parliamentary majority in an election debacle days before talks on Britain's EU departure are due to begin.
A stony-faced May, speaking on the doorstep of her official Downing Street residence, said the government would provide certainty and lead Britain in talks with the European Union to secure a successful Brexit deal.
May said she could rely in parliament on the support of her "friends" in Northern Ireland's Democratic Unionist Party after her governing Conservatives failed to emerge as clear winners.
Confident of securing a sweeping victory, May had called the snap election to strengthen her hand in the European Union divorce talks. But in one of the most sensational nights in British electoral history, a resurgent Labour Party denied her an outright win, throwing the country into political turmoil.
EU leaders expressed fears that May's shock loss of her majority would delay the Brexit talks, due to begin on June 19, and so raise the risk of negotiations failing.
Her Labour rival Jeremy Corbyn, once written off by his opponents as a no-hoper, said May should step down and he wanted to form a minority government.
But May, facing scorn for running a lacklustre campaign, was determined to hang on. Just after noon, she was driven the short distance from Downing Street to Buckingham Palace to ask Queen Elizabeth for permission to form a government - a formality under the British system.
With 649 of 650 seats declared, the Conservatives had won 318 seats and Labour 261 followed by the pro-independence Scottish National Party on 34.
The shock result thrust Northern Ireland's centre-right DUP into the role of kingmaker, with its 10 seats enough to give the Conservatives a fragile but workable partnership.
"Our two parties have enjoyed a strong relationship over many years and this gives me the confidence to believe that we will be able to work together in the interests of the whole United Kingdom," May said.
This was likely to involve an arrangement in which the DUP would support a Conservative minority government on key votes in parliament but not form a formal coalition.
But with the complex talks on the divorce from the EU due to start in 10 days, it was unclear what their direction would now be and if the so-called "Hard Brexit" taking Britain out of a single market could still be pursued.
After winning his own seat in north London, Corbyn said May's attempt to win a bigger mandate had backfired.
"The mandate she's got is lost Conservative seats, lost votes, lost support and lost confidence," he said. "I would have thought that's enough to go, actually, and make way for a government that will be truly representative of all of the people of this country."
"We need a government that can act," EU Budget Commissioner Guenther Oettinger told German broadcaster Deutschlandfunk. "With a weak negotiating partner, there's a danger that the (Brexit) negotiations will turn out badly for both sides."
The EU's chief negotiator said the bloc's stance on Brexit and the timetable for the talks were clear, but the divorce negotiations should only start when Britain is ready. "Let's put our minds together on striking a deal," Michel Barnier said.
But there was little sympathy from some other Europeans.
"Yet another own goal, after Cameron now May, will make already complex negotiations even more complicated," tweeted Guy Verhofstadt, the former Belgian premier who is the European Parliament's point man for the Brexit process.
May's predecessor David Cameron sought to silence Eurosceptic fellow Conservatives by calling the referendum on EU membership. The result ended his career and shocked Europe.
German conservative Markus Ferber, an EU lawmaker involved in discussions on access to EU markets for Britain's financial sector, was scathing.
"The British political system is in total disarray. Instead of strong and stable leadership we witness chaos and uncertainty," he said, mocking May's campaign slogan.
Sterling tumbled as much as 2.5 percent on the result while the FTSE share index opened higher. The pound hit an eight-week low against the dollar and its lowest levels in seven months versus the euro.
"A working government is needed as soon as possible to avoid a further drop in the pound," said ING currency strategist Viraj Patel in London.
Conservative member of parliament Anna Soubry was the first in the party to disavow May in public, calling on the prime minister to "consider her position".
"I'm afraid we ran a pretty dreadful campaign," Soubry said.
May had unexpectedly called the snap election seven weeks ago, even though no vote was due until 2020. At that point, polls predicted she would massively increase the slim majority she had inherited from Cameron.
May had spent the campaign denouncing Corbyn as the weak leader of a spendthrift party that would crash Britain's economy and flounder in Brexit talks, while she would provide "strong and stable leadership" to clinch a good deal for Britain.
But her campaign unravelled after a policy u-turn on care for the elderly, while Corbyn's old-school socialist platform and more impassioned campaigning style won wider support than anyone had foreseen.
In the late stages of the campaign, Britain was hit by two Islamist militant attacks that killed 30 people in Manchester and London, temporarily shifting the focus onto security issues.
That did not help May, who in her previous role as interior minister for six years had overseen cuts in the number of police officers. She sought to deflect pressure onto Corbyn, arguing he had a weak record on security matters.
"What tonight is about is the rejection of Theresa May's version of extreme Brexit," said Keir Starmer, Labour's policy chief on Brexit, saying his party wanted to retain the benefits of the European single market and customs union.
Analysis suggested Labour had benefited from a strong turnout among young voters.
The campaign had played out differently in Scotland, the main faultline being the SNP's drive for a second referendum on independence from Britain, having lost a plebiscite in 2014.
SNP leader and First Minister Nicola Sturgeon said it had been a disappointing night for her party, which lost seats to the Conservatives, Labour and the Liberal Democrats.
Scottish Conservative leader Ruth Davidson said Sturgeon should take the prospect of a new independence referendum off the table.