Sources told the Daily Telegraph the fault was linked to the Home Office’s “Warnings Index”, a national security system which the National Audit Office claimed eight months ago was "unstable and at risk of collapsing".

The system, aimed at preventing dangerous criminals entering the country, was introduced in the early 1990s with an intended shelf life of just seven years and is no longer up to date, the NAO warned.

When passports are scanned by border officers, the system automatically checks passengers' details against a register of terrorists, criminals, wanted persons and immigration offenders.

The glitch in the system meant staff were unable to access the database automatically and had to input passport details manually, causing long queues to form at the border.

Non-EU passengers were the worst affected, with some waiting up to four hours, and there were reports of fights breaking out with travellers given little information about how long they would be delayed.

One passenger who had arrived at Heathrow on a delayed flight from Vienna described the scene in the arrivals hall as “chaos”.

The 32-year-old project manager from south west London, who asked not to be named, said: “Nobody seemed to know what was going on, and there was nothing forthcoming from officials.

The Home Office apologised to passengers but said engineers had worked “through the night” and systems were “functioning normally” yesterday.

However it admitted that staff were continuing to examine the cause of the incident and refused to guarantee the problem would not resurface.

James Brokenshire, the immigration and security minister, said he had “asked technical staff to continue to look into the incident to ensure lessons are learnt.”