It was billed as one of the most unpredictable elections in decades but after six weeks of hard campaigning by two historically unpopular party leaders it ended with a conclusive result.
Conservative Party leader Boris Johnson won a sweeping victory, handing him a clear mandate to “get Brexit done”.
He had called the UK’s third general election since 2015 – and the first to be held in December for almost 100 years – in an effort to increase his parliamentary majority and end months of deadlock over the UK’s exit from the European Union.
It was a thumping defeat for the main opposition Labour party. Leader Jeremy Corbyn said Brexit had “polarised and divided debate”, shifting focus away from other, more traditional issues.
How did the night unfold?
The first indication of what was to come arrived at 22: 00 GMT, when the results of the BBC’s exit poll of thousands of voters was announced.
While earlier forecasts for the two main parties showed a narrowing of Mr Johnson’s lead over Mr Corbyn, the exit poll revealed something quite different: the Conservatives were forecast to win 368 seats, their biggest majority since 1987.
To command a governing majority, a party must win at least 326 of parliament’s 650 seats.
Labour was predicted to lose many of the seats it had gained previously, in 2017, and would take a hit in its traditional heartlands.
Shortly after 05: 00, it was confirmed that Mr Johnson had won an overall majority.
By 07: 00, it became clear the Conservatives were on course for their biggest majority at Westminster since the days of Margaret Thatcher, with 45% of the vote.
Voter turnout was 67.3% of the 47,587,254 people registered to vote.
What were the key moments?
There were significant losses for the Labour party, which analysts said were not just down to Brexit but to the leadership of veteran socialist Jeremy Corbyn.
Conservative party candidates triumphed in constituencies that had backed Labour for decades. The Welsh town of Wrexham had solidly supported the party since 1935, but on Thursday elected the first ever female Conservative MP in Wales.
In response, Mr Corbyn said a “very disappointing night” meant he would not lead the Labour party into the next election. But he refused to fall on his sword immediately. That would come, he said, after a period of quiet reflection.
The other big winners of the night were the pro-independence Scottish National Party (SNP). Party leader Nicola Sturgeon said there was a “renewed, refreshed and strengthened mandate” for a second Scottish independence referendum.
The leader of the Liberal Democrat party, Jo Swinson, lost her own seat in Scotland to the SNP.
Ms Swinson, who became leader of the UK’s fourth biggest party in July, said throughout her campaign that she aimed to be prime minister. She lost by just 149 votes. Several MPs had defected to the Lib Dems before the election, but the party failed to progress and its pitch to revoke Brexit without a second vote was widely seen as a mistake.
It was also a big night for nationalists in Northern Ireland.
The Democratic Unionist Party (DUP), which had propped up Mr Johnson’s Conservatives in parliament, suffered significant defeats. Nationalist MPs now outnumber unionists in Northern Ireland for the first time in a Westminster election.
The UK’s first-past-the-post voting system means that the candidate who receives the most votes in a constituency becomes an MP and is sent to Westminster. And the party with a majority then goes on to form a government.
What happens next?
The Conservatives said there would be a minor cabinet reshuffle at Downing Street on Monday, and that Mr Johnson’s Brexit Withdrawal Agreement Bill would be put back before MPs in a vote on Friday.
With his new majority, it is likely that the bill will now pass, paving the way for Britain’s exit from the EU on 31 January.
After that, Mr Johnson will work to renegotiate a new deal with the EU during a transition period, with trade and migration among the top issues on the table.
The prime minister has previously said the UK would fully exit the EU by December 2020 and that a deal, according to the Conservative election manifesto, would come into force in 2021.
The election result empowers the prime minister to see through whichever kind of Brexit he sees fit, however he may find it hard to secure a full deal by the end of next year. EU leaders said they were ready to start talks with the aim of maintaining “close co-operation” with the UK.
Mr Johnson has vowed to end freedom of movement between the EU and the UK and implement a new points-based immigration system. His government will also negotiate free trade agreements with other trading partners around the world.
Throughout the brief election campaign, the prime minister’s slogan had been “Get Brexit done” and when support for the Brexit Party fell away Leave voters opted for the Conservatives.
Remain voters, meanwhile, had a choice of several parties, which divided the vote.
Despite failing to win a seat, Brexit Party leader Nigel Farage told the BBC that his party had “killed the Liberal Democrats and hurt the Labour Party”.
General elections to choose a government are supposed to be held once every five years in the UK. After three in close succession, the country now faces a full term under Boris Johnson.