Here is a timeline of key moments during the EU referendum count:

Thursday June 23, 2016:

10pm - The last votes are cast and polling stations across the country close at the end of a day on which a record 46.5 million people were eligible to have their say. Ballot boxes are sent to 382 counting centres nationwide.

10pm - A YouGov opinion poll released at the same time suggests Remain are on course for victory with 52% and Leave on 48%.

10.15pm - Ukip's Nigel Farage concedes the Brexit campaign may be beaten and Remain "will edge it" - but promises "Ukip and I are going nowhere".

10.30pm - Sterling surges against the US dollar on the back of the favourable opinion poll for Remain and Farage's comments, rocketing to 1.5 dollars, its strongest performance in 2016.

10.30pm - A letter signed by 84 MPs, two thirds of whom openly backed Vote Leave, is delivered to Downing Street, urging David Cameron to stay on whichever way the result goes.

11.25pm - Gibraltar is the first area to declare, with a predictable landslide for Remain at 96% of the vote.

Friday, June 24:

12.04am - The first big result is declared, with a narrow win in Newcastle for Remain with 50.7% against Leave on 49.3%.

12.20am - Sunderland votes to Leave by a significant margin, with 61% in the Tyne and Wear town in favour of Brexit compared with 39% backing Remain.

12.30am - Sterling tumbles against the US dollar as jitters over a possible swing to Leave wipe earlier gains off the pound, with a near 4.7% drop - greater than the Black Wednesday crash in 1992.

1.55am - The City of London count is announced as vote to Remain in the EU.

2am - Bookmakers change their odds in favour of Leave winning the referendum, with Ladbrokes putting odds of 1/2 on a Brexit result. Having had an 86% chance of Remain winning at the close of polls, the odds have shrunk to 6/4, or 38%.

2.01am - Swansea votes to Leave, with 61,936 backing a Brexit against 58,307 voting to remain.

2.17am - Nigel Farage, who earlier said he sensed Remain would take victory, tweeted that he is "so happy with the results in North East England".

2.35am - Former Bradford West MP George Galloway appears to claim victory for Leave , tweeting: "First they ignored us. Then they laughed at us. Then they attacked us. Then we won #Lexit #Brexit".

3.11am - The City of Westminster votes to Remain.

3.27am - Sheffield comes out for Leave, backing an exit from the EU by little over 5,000 votes.

3.51am - Leave's lead stretches to 500,000 votes as results pass 200 out of 382.

3.57am - Sterling's slide against the dollar continues after victories consolidate a lead for Leave. Trading figures show the pound at 1.37 dollars, down from a high last night of over 1.5 dollars.

4.05am - Ukip leader Nigel Farage appears to claim victory in the EU referendum, saying: "Let June 23 go down in our history as our independence day". He calls the votes for the Leave campaign "a victory for real people, for ordinary people, for decent people", and asked if David Cameron should resign if the UK votes for Brexit, he replies: "Immediately."

4.13am - People in Wales vote to leave the European Union, despite a Remain win in Cardiff.

4.15am - With turnout data from all 382 counts, the estimated winning post is 16,768,027 votes.

4.39am - Both the BBC and ITV call a Leave victory based on analysis of the votes.

Page 2: 06:15

4.53am - Jenny Watson, national chief counting officer, estimates turnout for the referendum was 72.2%. There were 33,568,184 ballot papers from an electorate of 46,501,000.

5.26am - An error during a referendum count that resulted in the wrong turnout figure being declared in Hull is altered. Excluded postal votes led to an initial incorrect figure of 54.1%, one of the lowest turnouts in the country. This was altered to 62.9%; Hull voted to leave the EU, with 76,646 votes to Remain's 36,709.

6.02am - The Leave campaign officially passes the estimated winning post 16,763,272 in the EU referendum.

8.25am - David Cameron resigns as Prime Minister