More than 5,000 armed soldiers could be mobilised on UK streets in the event of terrorist attacks.

Details of the plan came to light after a secret document was accidentally uploaded to a police chiefs' website.

The military contingency plan, named Operation Temperer, was detailed in minutes from a closed session of the National Police Chiefs Council (NPCC). The document was swiftly taken down.

The plan would deploy up to 5,100 troops to support armed police providing "protective security", guarding against more attacks. Counter-terrorist experts and MI5 officers would work together on locating the people behind the attacks.

Temperer would only be triggered by the Cobra committee – the government's crisis coordination committtee, which is chaired by Prime Minister David Cameron – if at least two terror attacks occured at the same time in Britain.

Cameron said: "We will only defeat these brutal terrorists if we take action at home, overseas and online and if we unite with countries around the world, unite against this common enemy."

The leaked minutes stated: "Discussions were ongoing with the government," according to the Mail on Sunday. "Chiefs recognised that the Army played an important part in national resilience and supported the work going forward."

Plans not discussed

These highly controversial plans were drawn up by police chiefs and discussed at the highest levels of government, but never revealed to the public or mentioned in parliament.

Critics say the implementation of such a plan would give the impression that martial law was being imposed on the streets of London.

Baroness Jones, who sits on London's Police and Crime Committee, said: "This would be unprecedented on mainland Britain."

She also expressed concern that the troops would not be sufficiently trained to protect civil liberties.

Senior police officers discussed raising the terror threat level in the UK after the Paris massacres from "severe" to the highest level of "critical".

Shadow Home Secretary Yvette Cooper warned: "Our national security must not be put at risk. Theresa May has a responsibility to make sure we have enough police for vital counter-terror work."