The Attorney General's use of a ministerial veto to stop the public seeing letters the Duke of Cornwall's wrote to government ministers has been ruled unlawful.
Guardian journalist Rob Evans accused Dominic Grieve, the Government's principal legal adviser, of failing to show "reasonable grounds" for blocking disclosure of Prince Charles' letters.
The Upper Tribunal, headed by a High Court judge, declared in September 2012 that Mr Evans and the public were entitled to see the letters under the Freedom of Information Act 2000 (FOIA), and under the Environmental Information Regulations 2004.
The Government departments concerned with the correspondence did not appeal, but a month later the Attorney General issued a certificate under section 53 of the FOIA and used his ministerial veto.
Today Lord Dyson, the Master of the Rolls, and two other judges, Lord Justice Richards and Lord Justice Pitchford, ruled that the certificate should be quashed because Mr Grieve had "no good reason" for overriding the decision of the Upper Tribunal and he had acted in a way which was incompatible with European law.
The Attorney General was granted permission to appeal against today's ruling to the Supreme Court, the highest court in the land. The quashing order is stayed pending his appeal.
A spokesman for the Attorney General said: "We are very disappointed by the decision of the court. We will be pursuing an appeal to the Supreme Court in order to protect the important principles which are at stake in this case."
Mr Grieve said, in his opinion, Government departments were legally entitled to refuse disclosure because the correspondence was undertaken as part of the Prince's "preparation for becoming king".
Making the letters public could potentially damage the principle of the heir to the throne being politically neutral, and so undermine his ability to fulfil his duties when king, said Mr Grieve.
Dinah Rose QC argued on behalf of Mr Evans and the Guardian at the appeal hearing last month that Mr Grieve had used Section 53 "executive override" powers merely because he disagreed with the Upper Tribunal. "The implications for the rule of law are grave," she said.
Lawyers for Mr Grieve told the court that Parliament clearly intended allowing the Attorney General "to have the power to take his own view of what was in the public interest" despite the view reached by the tribunal.
But today Lord Dyson ruled: "The Attorney General did not have reasonable grounds for forming the opinion on which the (Section 53) certificate was based.
"The mere fact that he reached a different conclusion from the Upper Tribunal (UT) in weighing the competing public interests involved was not good enough.
"He had no good reason for overriding the meticulous decision the UT reached after six days of hearing and argument.
"He could point to no error or fact in the UT's decision and the Goverrnment departments concerned did not even seek permission to appeal it.
"The certificate is also unlawful because it is incompatible with EU law."
Both of the other judges agreed.
Mr Evans wants to shed more light "on the way the heir to the throne seeks to influence government ministers even though he holds no elected position".
He applied to see a number of written communications between Charles and various Government ministers between September 2004 and April 2005.
The Information Commissioner upheld the refusal of disclosure, but Mr Evans won his appeal to the Upper Tribunal.
The tribunal judges ruled that Mr Evans was entitled to "advocacy correspondence" from Charles, described as letters he had written seeking to advance the work of charities or to promote views.
But the Attorney General disagreed, and last July three High Court judges - led by the then lord chief justice Lord Judge - upheld his decision.
They ruled the use of the veto was lawful, and that Mr Grieve had reasonable grounds for deciding it was "an exceptional case meriting use of the ministerial veto to prevent disclosure and to safeguard the public interest".
Today the three appeal judges disagreed with the three High Court judges and ruled they had got the law wrong and their decision must be set aside.
It will now be for yet another panel of judges, this time at the Supreme Court, to make a final ruling.
The seven Government departments Charles wrote to are Business, Innovation and Skills; Health; Children, Schools and Families; Environment, Food and Rural Affairs; Culture, Media and Sport; the Northern Ireland Office and the Cabinet Office.