The detention policy adopted by UK forces in Afghanistan is unlawful, a High Court judge has ruled.
Serdar Mohammed, who was held in 2010 on suspicion of being a Taliban commander, is seeking damages for alleged breaches of his human rights.
The ruling centres on his detention for more than 100 days on UK bases.
The Ministry of Defence said that the decision could hamper the security of troops on the ground and it would appeal.
The court heard International Security Assistance Force procedures permitted detentions for a maximum of 96 hours, after which time people needed to either be released or handed over to the Afghan authorities.
In November 2009 the UK government adopted its own policy under which ministers could authorise detention beyond this time if it was believed a suspect could provide new intelligence.
Mr Mohammed's lawyers successfully argued in court that this policy breached his rights under the European Convention on Human Rights (ECHR).
The judge, Mr Justice Leggatt, found Mr Mohammed's arrest and initial detention for 96 hours had been lawful but it had then been unlawful to hold him on UK military bases for a further 106 days.
Three other Afghan nationals have also brought claims over their detention and in his ruling, Mr Justice Leggatt said the important question raised by this case was "whether the UK government has any right in law to imprison people in Afghanistan; and, if so, what is the scope of that right".
He said decisions had been "made to adopt a detention policy and practices in pursuit of military objectives which went beyond the legal powers available to the UK".
British forces have detained hundreds of people throughout the conflict in Afghanistan and the decision could open the door to hundreds of claims against the Ministry of Defence.
Speaking after the ruling, Defence Secretary Philip Hammond said: "It cannot be right for the ECHR to apply on the battlefield, restricting the ability of our troops to operate in combat."
He said that if the appeal were unsuccessful, the government would "examine other options open to us".
The chief of the Defence Staff, General Sir Nicholas Houghton said: "The judgement 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."
A spokesman for lawyers Leigh Day, who represent Mr Mohammed, said: "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."
Phil Shiner of Public Interest Lawyers, who represent the three other Afghan nationals, described the judgment as being of "profound importance... for future UK operations abroad".
UK forces are said to have detained Mr Mohammed, who is thought to be in his late 20s, in the Kajaki district of Helmand province as he fled along a road where a rocket-propelled grenade launcher was found after a firefight.
The High Court ruling on UK detention policy forms part of his damages claim against the MoD for alleged assault, false imprisonment and human rights breaches. The MoD disputes Mr Mohammed's claims of ill-treatment at the hands of UK armed forces.
After being held on UK bases, Mr Mohammed was transferred to the Afghan authorities. His lawyers say the MoD was also liable for damages because he was tortured by Afghan intelligence into confessing he was part of the Taliban.