Media playback is unsupported on your device Media caption Theresa May says the UK needs a period of stability

The UK has woken up to a hung parliament with the Conservatives as the largest party, after the general election produced no overall winner.

With nearly all results in, Theresa May faces ending up with 12 fewer seats than when she called the election.

The Tories are set to get 319, Labour 261, the SNP 35 and the Lib Dems 12. An overall majority requires 326 seats.

The BBC understands the PM will try to form a government, but Jeremy Corbyn also says he is "ready to serve".

The prime minister said the country needed "stability" after the inconclusive election result and the BBC's political editor Laura Kuenssberg said Mrs May intended to try and govern on the basis that her party had won the largest number of votes and seats.

There has been speculation she may seek some kind of informal arrangement with the Democratic Unionists, which won 10 seats in Northern Ireland, which could see it support the Tories on a vote-by-vote basis.

DUP leader Arlene Foster has said she expects "some contact" with the Tories over the coming days but she also told the BBC she believes Mrs May will find it "difficult to survive".

After a better-than-expected night for Mr Corbyn, Labour is set to pick up 29 seats. The Tories are on course to lose 13 seats. The SNP are down by 22, losing seats to the Tories, Labour and Lib Dems, in a major setback for Nicola Sturgeon.

Turnout so far is 68.7% - up 2% up on 2015 - but it has been a return to two-party politics in many parts of the country, with Labour and the Conservatives both piling up votes in numbers not seen since the 1990s and both set to top 40% of the vote.

Media playback is unsupported on your device Media caption Jeremy Corbyn: An "incredible result" for the Labour party

Media playback is unsupported on your device Media caption The Tories haven't won an overall majority

UKIP's vote slumped dramatically but rather than moving en masse to the Tories, as they had expected, their voters also switched to Labour.

Mr Corbyn, speaking after being re-elected in Islington North, said it was time for Mrs May to "make way" for a government that would be "truly representative of the people of this country".

He later told the BBC it was it was "pretty clear who has won this election".

"We are ready to serve the people who have put their trust in us," he said - but he also stressed he would not enter into any "pacts or deals" with other parties.

The Conservatives have said in the event of a hung Parliament, Mrs May would get the opportunity to form a government first, as her predecessor David Cameron did in 2010 when there was also no clear winner but the party had comfortably more seats than their nearest rival.

Analysis

Image copyright AFP

By BBC Political Editor Laura Kuenssberg

The conversations have started not just about whether the Tories will be able to form a government, but whether or not Theresa May can stay in her job.

There is no one prevailing mood inside the Tory party; as I write, Mrs May is holed up with her advisers inside Tory HQ.

But a former minister, Anna Soubry, has called for her to "consider her position" - political code for calling for her to resign.

Another senior MP tells me "I can't see how she can stay".

A minister texts to say the Tory party is "absolute monarchy, ruled by regicide and that's the territory we are in". One Tory source says it is "50:50" that she will quit in the morning.

But others are urging caution, calling for reflection, a period of calm.

Read Laura's full blog

Lord O'Donnell, formerly the UK's top civil servant, told the BBC that the prime minister had a duty to stay in post "for now" and had the right to seek the confidence of the House of Commons by asking it to approve a Queen's Speech, scheduled for 19 June.

He added that he would be advising her to seek an audience with The Queen later on Friday to explain her intentions over the coming days.

However, Labour has said it is ready to try and form a minority government of its own, while there is also a chance that the UK could be facing a fresh election later this summer.

Questions are also being asked about the potential impact on the upcoming Brexit negotiations which are due to start on 19 June.

The EU's chief negotiator, Michel Barnier, has hinted that this could now be delayed, tweeting that the talks should begin only when the UK is "ready".

Media playback is unsupported on your device Media caption Anna Soubry has given a frank assessment of her party's campaign

Although one party needs to get 326 seats to get an overall majority, in practice the Conservatives would be expected to be able to get a Queen's Speech through with 318 MPs, if they had the backing of the DUP MPs.

Conservative MP Anna Soubry, who is against Brexit, said it had been a "dreadful campaign" and Mrs May should "now consider her position".

But her Brexit-supporting colleague Steve Baker said it was essential the party supported Mrs May to "provide all the stability we can".

The Conservatives are forecast to win 42% of the vote, Labour 40%, the Lib Dems 7%, UKIP 2% and the Greens 2%.

Speaking at her count in Maidenhead, Theresa May said the full picture had yet to emerge, but added: "At this time more than anything else, this country needs a period of stability.

"And if... the Conservative Party has won the most seats and probably the most votes, then it will be incumbent on us to ensure we have that period of stability - and that is exactly what we will do."

Media playback is unsupported on your device Media caption Sturgeon: 'SNP have won the election in Scotland'

Media playback is unsupported on your device Media caption Nick Clegg: 'There's a huge gulf between young and old'

Speaking on ITV, George Osborne, who was sacked as chancellor last year by Mrs May, said: "Theresa May is probably going to be one of the shortest-serving prime ministers in our history."

Some big names lost their seat in a night of upsets - Alex Salmond lost to the Conservative candidate in Gordon and former Lib Dem Leader Nick Clegg lost his Sheffield Hallam seat to the Labour candidate.

Sorry, your browser cannot display this content. Find your constituency and candidates Enter a postcode or seat name Start typing to search Search for constituencies

In his defeat speech, Mr Clegg said Britain was now a "deeply divided and polarised" nation and he predicted the next Parliament faced the "excruciating task of trying to assemble a sensible government for this country".

Former business secretary Sir Vince Cable retook his Twickenham seat for the Lib Dems moments later - although the Lib Dems later lost Richmond Park to Conservative Zac Goldsmith after two recounts.

The Lib Dems, which are to end up with four more seats, have ruled out going into coalition with either the Conservatives or Labour.

The SNP's leader at Westminster, Angus Robertson, has lost his seat to Conservative Douglas Ross and the Tories also took Angus, in North East Scotland, from the SNP.

In other major developments:

SNP leader Nicola Sturgeon said she was "disappointed" to have lost a number of seats but claimed her party had still "won the election in Scotland".

She said she would like the SNP to "play a part in a progressive alternative to a Tory government" but would wait to see the final results.

The Green Party are unchanged with one seat and Plaid Cymru still have three MPs, while the Lib Dems are on course to gain five.

Green co-leader Caroline Lucas, who held Brighton Pavilion, said: "To be clear, Greens will never support a Tory government."

UKIP leader Paul Nuttall, who lost his bid to become the MP for Boston and Skegness, said: "Theresa May has put Brexit in jeopardy. I said at the start this election was wrong. Hubris."