Image caption Under the permit system, computers record biometric details

The UK Border Agency turned hundreds of people away from a key office after the major foreign national ID card computer system shut down.

An applicant said people sobbed at the Croydon Enquiry Office, in London, as officials said computers were frozen.

Later an agency spokesman said the system was "back up and running" but there would be "a small backlog of applicants to clear".

"Anyone who needs an urgent appointment will get one," he added.

News of the "IT outage" came amid fresh pressure on the Home Office over queues at Heathrow.

Earlier on Thursday, BAA, which operates the airport, said that the UK Border Force had failed to meets its target at the airport in April for processing most passengers from outside the European Economic Area within 45 minutes.

At Croydon, to the south of the capital, hundreds of people queuing for biometric visas or permits were told to go home because the UKBA system could not cope.

Shadow home secretary Yvette Cooper accused the UK Border Agency of "lurching from shambles to shambles", saying: "What on earth are the home secretary and her ministers doing?

"Instead of getting a grip, the government just keeps making it worse."

'Totally shambolic'

The Home Office operates a system of issuing biometric residence permits to foreign nationals and has distributed more than 600,000 of the ID cards since they were created almost four years ago.

The system does not cover foreign nationals who were legally resident in the UK before the launch.

One applicant whose visa appointment had been cancelled told the BBC that people were sobbing at the identity card centre as officials tried to explain the situation to them.

The system that was introduced was not fit for purpose. It was close to collapse a few weeks ago. It has now collapsed. It's an absolute mess Andrew Tingley, Iimmigration specialist, Kingsley Napley

"It's totally shambolic," said the applicant. "Officials have been saying they can't do anything for us today despite the fact that we have appointments.

"Normally if there is a problem they would rebook there and then. But we're being told to go home and book online - but that will mean weeks of waiting to get back into the system."

A UKBA spokeswoman said earlier the agency would "prioritise completing all outstanding applications".

People whose appointments had been cancelled could rebook through the UK Border Agency website or submit postal applications, she added.

But Andrew Tingley, an immigration specialist at law firm Kingsley Napley, said the collapse was "beyond farcical" because many applicants needed to have their permit dealt with on the same day.

"The system that was introduced was not fit for purpose," he said. "It was close to collapse a few weeks ago. It has now collapsed. It's an absolute mess.

"Employers are saying they can't access a reasonable immigration system and they're considering moving abroad. They've come to the point now where they're seriously considering not investing or working in the UK because they can't access any reasonably competent system."