The High Court has ruled unlawful the detention policy adopted by UK forces in Afghanistan.

The issue formed part of the damages claim for assault, false imprisonment and human rights breaches brought by Afghan farmer Serdar Mohammed, from the Kajaki district of Helmand province, who was captured in April 2010 on suspicion of being a Taliban commander.

He alleges he was tortured into giving a false confession after being transferred to the Afghan National Directorate of Security (NDS) facility at Lashkar Gah.

His allegations, particularly those of ill-treatment at the hands of UK armed forces, are strongly disputed and the Secretary of State for Defence wished to contest them at a full trial but Mohammed opposed that course and applied for preliminary issues, relating to the lawfulness of his detention by the UK between April and July 2010, to be determined.

Today, Mr Justice Leggatt said Mohammed's arrest on April 7 and initial detention for four days was lawful but his continued detention on UK military bases for a further 106 days was unlawful under the law of Afghanistan, international law and English law.

After the ruling, Defence Secretary Philip Hammond said: "I am disappointed by the court's decision. We cannot send our Armed Forces into battle with both hands tied behind their backs. Our troops engaged in operations must be able to detain our enemies who aim to maim and kill UK service personnel and innocent civilians.

"The Government will appeal the judgment. It cannot be right for the ECHR to apply on the battlefield, restricting the ability of our troops to operate in combat. If we do not succeed on appeal, we will examine other options open to us. We will not allow our combat effectiveness to be constrained by this judgment."

Chief of the Defence Staff, General Sir Nicholas Houghton said: " "The judgment is one which causes me operational concerns. It sits within a wider context where legal and safety issues, conceived for civilians in peace time, are being applied in an operational context.

"Our freedom to conduct detention operations and to exploit detainees for intelligence is vital to our ability to protect the lives of innocent civilians and our own forces. Any judgment which might inhibit our ability to operate in ways which minimise casualties and protect our people is deeply worrying."

A spokesman from lawyers Leigh Day, who represent Mohammed, said: " When we send our troops abroad it is the Ministry of Defence's job to ensure that the mechanisms are put in place to ensure that they operate within the rule of law.

"As the court has made clear, the MoD fully understood the parameters of the law regarding detention and yet they decided to operate flagrantly outside those rules."

Public Interest Lawyers, who represent three other Afghan nationals who have brought claims over their detention - Mohammed Qasim, Mohammed Nazim and Abdullah (no surname) - said the judgment was of "profound importance" with far-reaching implications for future UK operations abroad where UK personnel are on the ground.

"It tells the MoD again that, no matter how they try to avoid accountability for the UK's actions abroad, international human rights law will apply and, thus, UK personnel must act accordingly.

"The solution is straightforward - the MoD must ensure that UK armed forces personnel, like civilian police, are trained to know what the law does and does not allow and that they must follow the rule of law or face the consequences."

The judge said that, since 2001, UK armed forces had participated in the International Security Assistance Force (Isaf) in Afghanistan with the consent of the Afghan government under a mandate from the United Nations Security Council.

Isaf standard operating procedures permitted its forces to detain people for a maximum of 96 hours, after which time an individual must either be released or handed into the custody of the Afghan authorities.

UK armed forces adhered to this policy until November 2009, when the Government adopted its own national policy under which UK ministers could authorise detention beyond 96 hours for the purpose of interrogating a detainee who could provide significant new intelligence.

He said the Human Rights Act extended to the detention of Mohammed by UK armed forces in Afghanistan, and his arrest and initial detention complied with Article 5, which guarantees the right to liberty.

"However, his subsequent detention did not. The UK Government had no legal basis either under Afghan law or in international law for detaining Mohammed after 96 hours.

"Nor was it compatible with Article 5 to detain him for a further 25 days solely for the purposes of interrogation and without bringing him before a judge or giving him any opportunity to challenge the lawfulness of his detention.

"Mohammed's continued detention by the UK for another 81 days for 'logistical' reasons until space became available in an Afghan prison was also unlawful for similar reasons and was not authorised by the UN Security Council. In addition, this further period of detention was arbitrary because it was indefinite and not in accordance with the UK's own policy guidelines on detention."

Mohammed could not recover damages in the English courts based on the fact that his imprisonment by UK forces was illegal under Afghan law, but the Convention gave him an "enforceable right to compensation" which the courts were required to enforce.

He added: "This decision will not come as a surprise to the MOD, which formed the view at an early stage that there was no legal basis on which UK armed forces could detain individuals in Afghanistan for longer than the maximum period of 96 hours authorised by Isaf.

"I have found that this view was correct. Nothing happened subsequently to provide a legal basis for such longer detention, either under the local Afghan law, international law or English law.

"UK ministers nevertheless decided to adopt a detention policy and practices which went beyond the legal powers available to the UK. The consequence of those decisions is that the MOD has incurred liabilities to those who have been unlawfully detained."