Private letters written by Prince Charles to government ministers will not be made public, three senior judges have ruled.

In a long-running legal battle, the High Court judges upheld a decision by the attorney-general to veto the publication of letters to ministers by Prince Charles.

The letters had been requested by the Guardian newspaper under the Freedom of Information Act.

For eight years, the government has refused to disclose letters written by the prince to ministers, and the newspaper has fought the decision in the courts.

The prince, who has distinctive handwriting – his letters have been dubbed the “black spider memos” – has been accused of writing to ministers to air his views on government policy.

A freedom of information tribunal ruled in a landmark decision last year that 27 letters between the prince and the government over a seven-month period between 2004 and 2005 could not be withheld and could be published in the public interest.

However, Dominic Grieve, the attorney-general, later issued a certificate to override the tribunal’s decision arguing publication of the “particularly frank” letters reflecting the prince’s “most deeply held personal views and beliefs” would mean there was a risk the heir to the throne would not be seen to be politically neutral.

The Guardian sought to challenge the lawfulness of the Attorney-General’s decision and quash the certificate.

Giving his ruling, Lord Justice Davis said the Attorney-General “had reasonable grounds for certifying as he did”.

Copyright The Financial Times Limited 2018. All rights reserved.