British commanders have been accused by MPs of complacency over a Taliban attack on the main UK base in Afghanistan in which two US marines were killed and more than a dozen other personnel injured.
In a highly critical report, the Commons Defence Committee said force protection measures at Camp Bastion in Helmand province had been "inadequate" - with more than half the guard towers left unmanned - leaving troops exposed to "unnecessary risk".
Prince Harry was at the camp at the time of the attack during a four-month tour of duty and was moved to a guarded location as the fighting unfolded.
The report said "insufficient attention" had been given to the "fundamental requirement" of defending the base from external attack and that British commanders must bear a share of the responsibility for the "systemic failures" in security which had occurred.
The MPs were also scathing about the response of the Ministry of Defence, accusing it of being "obstructive and unhelpful" in the face of the committee's inquiries to establish what had happened - denying them access to key documents.
The attack on the Bastion complex, which includes the US Camp Leatherneck, took place on the night of September 14 2012 when 15 heavily armed Taliban insurgents dressed in US military uniforms cut through the perimeter wire on the eastern sector of the base.
In the ensuing firefight, two US marines were killed while eight other US personnel, eight British personnel and a civilian contractor were injured. Six US Harrier jump jets were destroyed and there was significant damage to other aircraft, vehicles and equipment.
Fourteen of the insurgents also died in the fighting and one was captured.
Following a US investigation into the incident, two US generals were forced to retire. However the committee said British officers must also bear a degree of responsibility - not least because the attack took place on the UK sector of the complex.
On the night of the incident, 13 of the 24 guard towers at the base were unmanned. They included the tower closest to the point where the insurgents broke through, which, the committee said, "contributed directly" to the failure to detect the attack at an early stage.
Security at the base may have been further weakened by a series of earlier breaches of the perimeter as well as the presence of a poppy cultivation right up against the fence.
While commanders believed most of the incursions were "low-level scrapping" by Afghans looking for metal to steal, the committee said they could have been exploited by the insurgents for surveillance and intelligence-gathering.
Even after an incident in March 2012 in which an Afghan interpreter commandeered a vehicle and drove it at a party of troops on the runway waiting to welcome then US defence secretary Leon Panetta, there was no overhaul of security arrangements, allowing "weaknesses" in command and control to persist.
Overall, the committee found allied commanders at Bastion appeared to have been focused on security incidents elsewhere in Helmand and on the threat of another "insider" attack by an Afghan working at the base, rather than an external assault.
"We are concerned that the perimeter security and force protection measures in place at the time of the attack were inadequate," the report said.
"Insufficient attention was given to the fundamental requirement of defending Camp Bastion from external assault. We believe that this was complacent.
"Given that the attack took place in the British sector of the camp, British commanders must bear a degree of responsibility for these systemic failures and associated reputational damage."
Defence Secretary Philip Hammond said that the lessons from the attack had been learned and acted upon.
"The MoD is not complacent and always seeks to capture and learn lessons from current operations," he said.
"Commanders in the field have to prioritise resources against potential threats in theatre and at the time a threat to Camp Bastion was considered to be lower than to other Isaf assets in Helmand. UK commanders have identified and acted upon all lessons following the attack on Camp Bastion in 2012."
He added that "a considerable amount" of classified information had been released to the committee in the course of its inquiry.
Shadow defence secretary Vernon Coaker said: "This was a dreadful attack resulting in the loss of life. It is a reminder of the hugely difficult circumstance in which our armed forces operate.
"The report has established and examined the causes and consequences of the attack, and that is to be welcomed. It is clear that mistakes were made and it is vitally important that lessons are learned.
"In order to help that happen, I hope the Ministry of Defence will now disclose all of the outstanding information requested by the committee."