Fresh claims have emerged that MI5 was aware of allegations that Afghan detainees were being mistreated by the country's security service during the period UK forces were handing prisoners over to the Afghan authorities.

Last week the high court heard details of torture allegedly suffered by prisoners handed over to the Afghan domestic security service. A memo, seen by the Observer, reveals that the head of Afghanistan's intelligence agency indicated to UK officials in March 2007 that he was aware of ill-treatment claims involving prisoners.

In the document, marked confidential, Amrullah Saleh, chief of the National Directorate of Security (NDS), admits he is "aware of allegations of mistreatment" relating to detainees in Kandahar province.

Human rights lawyers allege that no action appears to have been taken by UK forces as a result and that British troops handed over detainees to the NDS Kandahar facility in 2007.

The memo coincides with a judicial review in the high court, being brought by anti-war activist Maya Evans against Britain's policy of transferring suspected insurgents.

The court heard how six Afghan detainees – Taliban suspects – handed over by British troops to NDS prisons were allegedly deprived of sleep, whipped with rubber cables and subjected to electric shocks. Backed by law firm Public Interest Lawyers, Evans argues Britain has breached the Human Rights Act by handing over prisoners to a country known to participate in torture. The lawyers claim the NDS had a notorious reputation for mistreating prisoners and British officers should have known of the risks.

Saleh's admission is contained in a memo written a month before allegations surfaced in the Canadian press that the country's soldiers deliberately transferred prisoners to be tortured. The allegations provoked uproar in Canada with pressure still building on the government to launch a public inquiry into the claims.

The judicial review heard the government concede that British forces had maintained access into the NDS facility for UK interrogators, suggesting a close intelligence relationship with the Afghans. The judges also heard claims that government denials of such detainee abuse involving British forces were the result of a "head in the sand" attitude.

Lawyers for the Ministry of Defence deny that detainees routinely handed over by British soldiers suffer torture and insist safeguards against their mistreatment were in place.

In late 2008, military and Foreign Office officials were denied access to Afghan detention centres while UK forces were told not to transfer any more captured Afghans to the NDS.

Jonathan Evans, director-general of MI5, recently strenously denied complicity in torture, adding "nor do we collude in torture or encourage others to torture on our behalf".

Evans said: "Only now has the government clearly admitted that it cannot hand over prisoners where there is a risk of torture by the NDS. The evidence is overwhelming. This practice must stop."