The High Court has ruled that Justice Secretary Ken Clarke was wrong to stop the BBC filming a terrorism suspect held for seven years without trial.
The court said there was public interest in interviewing Babar Ahmad, due to the case's exceptional nature.
The Justice Secretary had argued an interview was not necessary to inform the public about Mr Ahmad's story.
The British Muslim denies terror-related charges and is fighting extradition to the US.
After the ruling, the justice secretary said he would not be appealing against the verdict and would now begin negotiations with the BBC about how and when the interview would take place.
The 37-year-old south London man has been held in prison pending extradition since 2004, believed to be a record for an unconvicted British citizen. He is awaiting a final decision on his case by the European Court of Human Rights.
Mr Ahmad is accused of fundraising for extremists and other offences, all of which are said to have been committed in the UK. He has never been charged or faced trial in this country and denies any wrongdoing.
Last year, more than 140,000 people signed an official government e-petition calling for him to be tried in the UK, leading MPs to include his case in two Parliamentary debates.
At the High Court hearing last year, the BBC argued that the Justice Secretary had the power to restrict journalists' access to prisoners - but he had been wrong to turn down an application from reporter Dominic Casciani to film Mr Ahmad.
Lord Pannick QC, for the BBC, said that the refusal to allow an interview breached the journalist's freedom of speech as set out in Article 10 of the European Convention on Human Rights.
In their judgement, Mr Justice Singh and Lord Justice Hooper said: "The [interview ban] constitutes a disproportionate interference with the right to freedom of expression in Article 10. In the circumstances of this particular case, the justification for that interference has not been convincingly established.
"The claimants have demonstrated on the evidence before the Court that they do require a face-to-face interview with Mr Ahmad."
Counsel for the Justice Secretary had argued that allowing BBC cameras into prison would open the floodgates to many more such stories. But the court said Mr Ahmad's case was "far from ordinary" and there was public interest in seeing and hearing from Mr Ahmad.
"It is difficult to think of a case which would fall within the exception if not for the present case," said the judges.
"We make it clear that we do not consider that the present case should be regarded as setting any precedent for other cases.
"The crucial question is whether in the very unusual circumstances of the present case, when taken together, an exception must be made. We have come to the conclusion that it must."
After the ruling, the Ministry of Justice issued a statement saying the length of time taken in the Ahmad extradition case was "unacceptable", and blamed a backlog of 150,000 cases at the European Court of Human Rights for the delay.
It highlighted that the judge had upheld the Prison Service's general policy on refusing media interview requests with prisons unless there were "exceptional circumstances".