With Cameron's Conservatives on the cusp of winning a majority in the 650-seat House of Commons, the election result looked to be far better than opinion pollsters, or even his own party, had foreseen. The prime minister was beaming early Friday as he as announced the winner of his Witney constituency in southern England.
"This is clearly a very strong night for the Conservative Party," he said, stopping just short of declaring victory.
"I want my party, and I hope a government that I would like to lead, to reclaim a mantle that we should never have lost — the mantle of one nation, one United Kingdom," Cameron said, vowing to counter the rise of Scottish nationalism with more powers for Scotland and Wales.
The opposition Labour Party, led by Ed Miliband, was routed in Scotland by the Scottish National Party, which took almost all of the 59 seats in Scotland.
"What we're seeing tonight is Scotland voting to put its trust in the SNP to make Scotland's voice heard, a clear voice for an end to austerity, better public services and more progressive politics at Westminster," party leader Nicola Sturgeon told the BBC.
"The Scottish lion has roared this morning across the country," said former SNP leader Alex Salmond, who was elected in the seat of Gordon.
Scottish Labour leader Jim Murphy insisted he would not resign despite losing his seat but Miliband's grip on the leadership seemed more tenuous, as the party failed to make predicted gains against the Conservatives across the rest of Britain.
"This has clearly been a very disappointing and difficult night for the Labour Party," said Miliband. "In Scotland we have seen a surge of nationalism overcome our party."
Cameron's coalition partner, the Liberal Democrat party, faced an electoral disaster, predicted to lose most of its seats as punishment for supporting a Conservative agenda since 2010.
"It is now painfully clear that this has been a cruel and punishing night for the Liberal Democrats," said leader Nick Clegg, who held onto his own seat. He said he would discuss his future with colleagues later Friday.
The exit poll projected that the Conservatives would get 316 seats — up from 302 and far more than had been predicted — and Labour 239, down from 256. It said the Liberal Democrats would shrink from 56 seats to 10, while the Scottish nationalists would grow from six to 58. The anti-immigration, anti-Europe UK Independence Party was projected to win two seats.
Based on interviews with 22,000 voters, the poll differed strongly from opinion polls conducted during the monthlong election campaign, which had put the Conservatives and Labour neck-and-neck.
As results rolled in overnight, the Conservative Party appeared to be in a commanding position to form the next government, either alone or by seeking partners from smaller parties. One result could be re-run of the Conservative-led coalition with the Liberal Democrats that has governed since 2010.
The chief exit pollster, John Curtice of Strathclyde University, said it looked as if Conservative and Labour gains had cancelled each other out across England and Wales, and that Labour had lost much of its support in Scotland to the SNP.
"We now have to take seriously the possibility the Tories could get an overall majority" in Parliament, he said.
The survey was conducted by pollsters GfK and Ipsos MORI for Britain's broadcasters and released as polling stations closed and the counting began.
Each of the 650 constituencies are counted by hand and the results follow a familiar ritual. Candidates — each wearing a bright rosette in the colour of their party — line up onstage like boxers as a returning officer reads out the results.
But if the form was familiar, the results were often shocking.
Among the early Scottish National Party winners was 20-year-old student Mhairi Black, who became Britain's youngest lawmaker since the 17th century by defeating Douglas Alexander, Labour's 47-year-old foreign policy spokesman and one of its most senior figures. Black is the youngest lawmaker since 13-year-old Christopher Monck entered Parliament in 1667.
The UK Independence Party ran third in opinion polls, but by early Friday had won only one seat because its support isn't concentrated in specific areas. Leader Nigel Farage said he would resign if he does not win the seat of Thanet South — an outcome that looked a distinct possibility.
Britain's economy — recovering after years of turmoil that followed the 2008 financial crisis — was at the core of many voters' concerns. The results suggest that many heeded Cameron's entreaties to back the Conservatives as the party of financial stability. Public questions at television debates made plain that many voters distrusted politicians' promises to safeguard the economy, protect the National Health Service from severe cutbacks and control the number of immigrants from eastern Europe.
In Whitechapel, one of London's poorest communities, voters struggling in the wake of the worst recession since the 1930s wanted a change in leadership.
"The first priority is the economy, the second one is creating more jobs, and the third is living expenses — they're going higher and higher," said Shariq ul-Islam, a 24-year-old student.
But just a few minutes away in the City of London, the traditional financial district where many bankers earn enormous salaries, Christopher Gardner, a 34-year-old finance industry official, put his trust in the Conservatives.
"There are some issues that have been caused by austerity previously," he said. "They're the only people that I'm confident will resolve that."
Sylvia Hui, Paul Kelbie, Gregory Katz and Martin Benedyk contributed to this story.Suggest a correction