Media playback is unsupported on your device Media caption The prime minister said the government was "working urgently" with Electoral Commission

David Cameron has urged people to continue to register to vote after an online glitch ahead of the EU referendum registration deadline.

Ministers say they are considering urgent legislation to allow people applying after the deadline to vote and have promised updates when possible.

The Electoral Commission has called for legislation to extend the deadline.

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.

Responding to an urgent question in the Commons, Cabinet Office Minister Matthew Hancock said people should carry on registering to vote on the government's site..

"Those registrations will be captured by the system - then we have the legal question about whether captured applications can be eligible for the 23 June," he added.

He said the aim was that everyone who wanted to was able to take part in "this great festival of democracy".

Opposition parties have 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.

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.

Half a million applications

Opening Prime Minister's Questions, Mr Cameron said people should continue to register on Wednesday, saying the government was working urgently with the commission to "make sure those who registered today and who registered last night will be able to vote in the EU referendum".

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.

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.

In a statement, the commission said it was "vital" everyone who wants to vote on 23 June is able to do so, with a "very significant increase" in online applications on Tuesday.

It added: "There will be many people who wanted to register to vote last night and were not able to.

"The registration deadline is set out in legislation and we have said to the government this morning they should consider options for introducing legislation as soon as possible that would extend the deadline.

"We would support such a change."

The Cabinet Office said: "We are urgently considering what the options are for those who were unable to register to vote last night."

Labour leader Jeremy Corbyn and the SNP's Westminster leader Angus Robertson also called for the deadline to be extended.

Mr Robertson said it "must be" extended because "nobody should be denied their vote".

Justice Secretary Michael Gove welcomed the Cabinet Office's investigation, and hoped for a large turnout.

He added: "I know these are complex legal waters but I would not want to do anything to frustrate people's opportunity to register."

Vote Leave said: 'We want everyone to have a chance to vote in this referendum, however our main concern is that the Electoral commission seems to be doing so little stop EU nationals from registering to vote in this referendum."

Image copyright Gov.uk Image caption This was the message seen by some visitors to the site on Tuesday evening

Earlier a Cabinet Office spokesman said: "We became aware of technical issues on [the registration website] late on Tuesday night due to unprecedented demand.

"Some people did manage to get through and their applications were processed. We tried to resolve the situation as quickly as was possible and to resolve cases where people tried to register but were not able to."

Who is eligible to vote in the EU referendum

British or Irish citizens living in the UK who are 18 or over

Citizens of Commonwealth countries who are 18 or over and who have leave to remain in the UK

British citizens living overseas who have been registered to vote in the UK in the last 15 years

Irish citizens born in Northern Ireland now living overseas

Irish citizens living overseas who have been registered to vote in Northern Ireland in the past 15 years

The number of applications does not necessarily equate to the number of people being registered, as some may come from people who are already signed up to vote.

In 2015 there were just under 5 million applications to register in England and Wales between January and the day of the general election, but the total number of people on the register went up by just 1.35 million.

Image copyright AFP Image caption Voters will have two options on the ballot paper

The commission has said that its most recent estimate, from 2014, suggested 7.5 million were not correctly registered despite being eligible to vote. But it is known that the figure was cut by millions during the general election campaign last year - and there have been more than two million applications to register to vote in the past month.

Levels of turnout - the number of people who actually vote - are likely to be crucial to the outcome of the referendum, with both sides trying to mobilise their supporters and to warn people of the consequences of staying at home on the big day.

The commission has said levels of awareness about the referendum had increased considerably in recent weeks.

Those eligible to cast a vote - which include British or Irish citizens living in the UK who are 18 or over and Citizens of Commonwealth countries who are 18 or over and who have leave to remain in the UK - have to be on the electoral register to actually do so.

To apply to vote by proxy, people need to complete a separate application form, to be returned by 17:00 BST on 15 June.