Image copyright Getty Images

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

Cabinet Office minister Matt Hancock said the government would legislate to extend the cut-off until midnight on Thursday.

It follows a computer glitch which left some people unable to sign up before the original midnight Tuesday deadline.

The Electoral Commission urged people to sign up until the end of Thursday in order to vote on 23 June.

The glitch, blamed on record demand, lasted from 22:15 BST on Tuesday until after the midnight cut-off.

Users reported a page displaying the message "504 Gateway Time-out" instead of the online registration form.

There had been calls from both sides of the EU debate for the deadline to be extended, although the move was criticised by some Conservative MPs.

A last-minute surge in demand was blamed for the technical problems.

According to the government's data website, 525,000 people applied to register to vote during the day - 170,000 were aged 25 to 34, 132,000 under the age of 25 and 100,000 aged 35 to 44.

It also shows that the peak users came at 22:15 BST when 50,711 people were using the service at the same time. There were 26,000 people on the site at 23:55 BST and 20,416 people using the site at 12:01 BST, just after the deadline.

Media playback is unsupported on your device Media caption Bernard Jenkin says the EU referendum registration is 'a shambles'

The government's data site does not record whether these users were successful or not in attempting to register to vote. It is also not clear whether these figures include those who got an error message.

Analysis by Iain Watson, BBC political correspondent

Cock-up or conspiracy? Some Brexiteers see an extension of the voting registration deadline as both.

Sir Gerald Howarth has said potential voters had "months and months" to register so the deadline shouldn't be shifted but many of his colleagues are biting their tongues for fear of looking anti democratic.

A two-day extension in registration to compensate for a two hour failure in the website is seen as suspicious.

Off the record, one senior Conservative said: "We all know what they are up to - there will be a big social media push by Remain to get young people to register tomorrow."

More than 300,000 of the 525,000 who applied to register yesterday were under 34 - and that age group, polling suggests, is more likely to back EU membership. Another Conservative fulminated: "They wouldn't have done this at a general election" and one of his colleagues opined: "If the age profile was the other way round we wouldn't be doing this."

The atmosphere between the Remain and Leave camps is already combustible but if there's a close result, the row may even explode into a formal challenge.

Mr Hancock, who said he was "delighted" at the "huge voter registration levels", told MPs the number of applications per hour had reached record level.

He said 214,000 applications per hour had been received at peak time, compared with 74,000 ahead of last year's general election.

MPs will debate the extension on Thursday, Commons leader Chris Grayling said.

Conservative MP Sir Gerald Howarth said people had had "months and months" to register to vote and it was "their fault" if they had left it until the last minute.

His party colleague Ian Liddell-Grainger said the extension to the deadline amounted to "gerrymandering" and another Tory, Andrew Bridgen, said it set a "very dangerous precedent".

Earlier, during an urgent statement in the Commons, Conservative MP and Leave campaigner Bernard Jenkin said it might be legal to extend the deadline for a few hours, but said "any idea of rewriting the rules in a substantial way would be complete madness and make this country look like an absolute shambles" with a risk of a legal challenge to the referendum result.

Opposition parties had expressed anger at the events and called for an extension to the deadline, with Lib Dem leader and pro-Remain campaigner Tim Farron saying it was a "shambles" that could affect the referendum result.

The justice secretary, leading Leave campaigner Michael Gove, said: "In my heart is a desire to ensure that everyone possible can be given the vote.

"The more people who vote the better. This is a lifetime-defining decision. I would like to see everyone who possibly can and who is entitled to vote play a part in this."

People who voted in last months' UK-wide elections have no need to re-register for the EU referendum. Postal votes are unaffected.