The deadline for registering to vote in the EU referendum has been extended until midnight on Thursday, the government has said.

It comes after a website crash last night due to "unprecedented demand" caused chaos as frustrated users reported getting several error messages just hours before the 11:59pm cut-off.

The problems sparked nationwide calls for an extension.

Cabinet office minister Matt Hancock said the government would introduce legislation to extend the deadline, and is urging those who have not yet registered to do so.

He said in a statement: "Having taken the decision today, we think it is right to extend to 23.59 on Thursday 9 June, to allow people who have not yet registered, the time to get the message that registration is still open and get themselves registered."

Users reported seeing an error message saying “504 Gateway Time-Out” or “HTTP 500 error” instead of the registration form around 90 minutes before the deadline, according to national reports.

Figures on the government’s data website show 525,000 people applied to register to vote during the day of which 170,000 were aged between 25 and 34 and 132,000 were under 25. Almost 14,000 British expats also applied.

It is unclear how many of these faced the problems from last night.