Barristers representing the government are due to go to the supreme court in the latest attempt to keep secret a series of letters written by Prince Charles to government ministers.

They will argue on Monday morning that the then attorney general, Dominic Grieve, acted lawfully when he overrode a court two years ago to veto the publication of the letters written by the prince to influence official policies.

For nine years, the Guardian has been pressing the government to release the letters under the freedom of information act, but ministers, supported by the Prince of Wales, have refused.

Lord Neuberger, the president of the supreme court, is due to sit for two days, along with six leading judges, to hear legal arguments before delivering a judgment at a later date.

The prince has gained a reputation for writing private letters to government ministers promoting his views. These letters have been termed the “black spider memos” because of his scrawled handwriting.

Last week the Guardian revealed how Charles is set to reshape the sovereign’s role by making “heartfelt interventions” in national life if he becomes king.

At issue in the supreme court hearing are 27 letters exchanged between the heir to the throne and government ministers in seven Whitehall departments between September 2004 and April 2005.

Three judges in a freedom of information tribunal had ruled in 2012 that the letters should be disclosed as the public was entitled to know how and when the prince sought to influence government.

But Grieve issued a veto overruling the tribunal, arguing that the publication of the letters would seriously damage Charles’s future role as king.

He argued the letters had to be kept secret to preserve the heir’s position of political neutrality.

Grieve’s use of his veto was ruled to be unlawful by the court of appeal in March. Lord Dyson, the leading civil judge in England and Wales, and two senior judges, decided that Grieve had “no good reason for overriding the meticulous decision” of the tribunal.

On Monday, the government’s case is due to be presented by James Eadie and Karen Steyn QCs while the Guardian is represented by Dinah Rose QC, Ben Jaffey and Aidan Eardley.