The UK government has been blocked from resuming the transfer of detainees caught in Afghanistan by UK forces to the Afghan authorities.
High Court judges said the block would remain in place until the court could rule on whether there was "a real risk" that detainees would face torture.
The defence secretary had allowed transfers to start again after previously halting them in April.
But lawyers for one detainee had argued there was a real risk of torture.
Philip Hammond decided in October that the transfer of detainees to the Afghan National Directorate of Security (NDS) - the Afghan intelligence could safely start again after imposing a moratorium in April.
But Dinah Rose QC, representing Serdar Mohammed, said he had suffered severe torture and the evidence that transfers could now safely take place was "highly contentious".
His ill treatment included being beaten on the feet with a pipe once a day for two hours during interrogation lasting three days during 2010, she told judges.
She said the minister's decision followed assurances given by the new head of the NDS, Assadullah Khaled, and new "safeguards" introduced at Lashkar Gah.
But there was extensive and credible evidence, argued Ms Rose, that Mr Khaled, a former governor of Ghazni province and later Kandahar, had "personally committed and presided over torture".
The allegations were not only from human rights organisations and journalists but senior diplomats and other officials, including those at the British embassy in Kabul.
She argued the transfers should not be resumed before the minister's decision could be challenged at a judicial review application which was due to start on 27 November.
The High Court judges agreed.
Lord Justice Moses said: "It seems to me that that which caused the Ministry of Defence to impose a moratorium raises the very question that justifies imposition of interim relief."
Mr Justice Simon agreed but stressed the court had not reached a conclusion on the ultimate merits of Mr Mohammed's case.
Solicitor Richard Stein, who represented Mr Mohammed, said: "We are extremely relieved that the court prevented the government from restarting transfers of UK detainees in Afghanistan to any Afghan facility, including the notorious Afghan secret police facilities."
Reprieve's legal director Kat Craig said: "It is shocking that the government is trying to lift a ban on transfers to the Afghan security services with one hand, while covering up evidence of torture with the other.
"For now, they have not succeeded, but should plans for secret courts pass Parliament this will become child's play. Our parliamentarians must stand firm against plans to do away with centuries-old traditions of open and equal justice."
The judges said the court had taken into account the fact that UK forces were having to detain an increasing number of suspected insurgents who could not be handed over to the Afghan authorities, including those who engaged in "organised disobedience".
A Ministry of Defence spokesman said: "The temporary hold on the transfer of UK-captured detainees to the Afghan National Directorate of Security will remain in place until the court has had an opportunity to review all evidence and conduct the Serdar Mohammed judicial review.
"It would be inappropriate to comment further until the outcome is known."