A terror suspect, who has been detained without trial for seven years pending deportation to the US, can give a filmed interview to the BBC, the high court has ruled.

The case of Babar Ahmed, 37, is so "exceptional" that the Ministry of Justice's ban on the interview was a "disproportionate interference with freedom of expression" and must be quashed, Mr Justice Singh and Lord Justice Hooper said.

But the corporation's victory should not set "any precedent for other cases" in terms of allowing journalists access to prisoners, the court added.

The case was brought by the BBC and one of its home affairs correspondents, Dominic Casciani. who had been seeking to broadcast an interview with Ahmed who has been held without trial for longer than anyone else in recent history.

The high court judgment declared: "It is because of the unusual combination of facts that the present case, in our view, justifies departure from the normal policy.

"More than that, in our view, the claimants' rights under article 10 require that departure in the exceptional circumstances of this case, and the [justice] secretary has not been able to justify denying those rights on the facts of this case.

"However, [he] is entitled to maintain the policy [controlling access to prisoners for journalists] which he does: no challenge has been made to his entitlement to have such a policy in principle and to apply it to the great majority of cases."

Ahmad, a British Muslim, is detained under extradition laws as he fights removal to the US, where he is wanted for allegedly raising funds for Chechen and Afghan insurgents over the internet. He strongly denies involvement with terrorism.

He is in a special unit at Long Lartin prison, Worcestershire, waiting for the European court of human rights to rule on whether he should be extradited. The court was told that an ECHR ruling was being prepared "as a matter of urgency".

There is a long history of journalists facing obstacles when attempting to talk to prison inmates, including men and women who allege they are victims of miscarriages of justice or abuses of power by the authorities.

Before the last election, the prison service attempted to prevent the Guardian from interviewing two convicted terrorists who alleged that UK intelligence agents had been complicit in the torture that they suffered in Pakistan before being deported to the UK to stand trial.

Delays in one case lasted nine months, and in the second for 15 months. A visit was granted only after the Guardian threatened to go to court to seek a judicial review of the Ministry of Justice's refusal.