Scottish courts do not have enough "safeguards" to protect the media's right to report cases, the European Court of Human Rights (ECHR) ruled today.
It found that the UK Government had violated two articles of the Human Rights Convention, which is designed to protect freedom of expression.
The latest case, brought by BBC Scotland and journalist Alan Mackay against the UK Government, centred on reporting restrictions imposed after a 2004 court case.
The trial at the High Court in Glasgow was abandoned after it emerged that police officers and prosecution staff had been watching the proceedings in a remote viewing room and may have heard defence conversations.
The trial judge imposed an interim order under section 4(2) of the Contempt of Court Act 1982 banning the publication of any report of the proceedings until the completion of any appeal and further trial.
While in England and Wales people can appeal against such orders at the Court of Appeal, this part of the Criminal Justice Act 1988 does not apply to Scotland.
Instead, Scottish courts give interim orders for 48 hours, tell the legal representatives of media organisations and give them the opportunity to address the court on the terms of the interim order.
In its judgment, the ECHR said that this practice may work well in the majority of cases.
But it went on: "Nevertheless, the fact remains that, under the present system, any Scottish court which makes a section 4(2) order is under no obligation to hear representations from the media and, even where it does hear such representations, there is no obligation upon it to do so within a reasonable period of time and in any event prior to the proceedings to which the section 4(2) order relates."
It said the practice appeared to depend entirely on the media making "informal contact" with court officials to arrange an appropriate hearing.
It went on: "This approach may have the advantage of flexibility but the potential shortcomings are self-evident.
"The court has repeatedly stated that freedom of expression constitutes one of the essential foundations of a democratic society and that, in that context, the safeguards guaranteed to the press are particularly important.
"When proper consideration is given to what is at stake for the media when section 4(2) orders are imposed, it becomes apparent that current Scottish practice provides too slender a basis for the safeguards which are required in this context."
In the case in question, an appeal hearing against the permanent abandonment of the trial was set for February 15 2005 and that day the court banned publication of any part of the appeal hearing until it was complete.
BBC Scotland maintains its representative went to the High Court that morning but was not heard and the interim order became final on February 17.
The applicants complained under Article 10 of the Convention that this was an unjustified interference with their right to impart information and, under Article 13 of the Convention, that there was no effective remedy to challenge the making of an order under section 4(2) of the Contempt of Court Act 1983.
They argued that they were denied the opportunity to seek the recall of the order for four months, and by the time the order was recalled on June 21 2005, the story of the appeal had become "stale news".
The ECHR ruled that article 10 had been violated in conjunction with article 13.
BBC Scotland had also complained under article 6 that its right of access to court was violated by the refusal to hold a hearing at which it could challenge the February 15 order, but this was rejected.
The case is the second time in three months that the Scottish legal system has been held to be in breach of the European Convention on Human Rights.
In October the Supreme Court held in the case of Cadder v HM Advocate that the police practice of interviewing criminal suspects without allowing them to have legal advice was not permissible and could not be allowed to stand in the face of a contrary decision by the European Court of Human Rights.
A BBC Scotland spokesman said: "We ran into confusion in trying to challenge reporting restrictions in a drugs trial, which sparked our application to the European Court of Human Rights.
"This wasn't typical - the Scottish courts have very often heard such challenges from us in the past - but it showed a need for clarity in the process, to protect good, contemporaneous court reporting."
A Scottish Government spokesman said: "The Scottish Government supports the freedom of the press in reporting of court proceedings.
"The judgment recognises that there are cases and circumstances where reporting restrictions are necessary, but that more clarity is needed in one procedural aspect of how the court deals with challenges to reporting restrictions.
"The Scottish Government is already working with the courts to address the issues raised by this case."