The government has blocked the disclosure of a set of confidential letters written by Prince Charles to ministers.

Dominic Grieve, the attorney general, issued a veto that puts an absolute block on the publication of 27 letters between the prince and ministers over a seven-month period. Grieve said the letters contained the "particularly frank" and "most deeply held personal views and beliefs" of the prince.

The decision comes after seven government departments lost a long-running freedom of information tribunal over the disclosure of the letters.

The veto overrides last month's ruling by the tribunal that the public had a right to know how the prince sought to change government policy.

Grieve's decision comes after seven years of government resistance to the Guardian's request to see copies of the prince's letters to ministers over the seven-month period in 2004 and 2005.

Following his decision, the Guardian announced that it would be seeking to take the government to the high court to challenge the veto on the grounds that it had acted unreasonably.

The prince has for some years been accused of meddling in government affairs and seeking to influence ministers to alter policy.

In a statement on Tuesday justifying his use of the veto, Grieve said: "Much of the correspondence does indeed reflect the Prince of Wales's most deeply held personal views and beliefs. The letters in this case are in many cases particularly frank.

"They also contain remarks about public affairs which would in my view, if revealed, have had a material effect upon the willingness of the government to engage in correspondence with the Prince of Wales, and would potentially have undermined his position of political neutrality."

Grieve continued: "In summary, my decision is based on my view that the correspondence was undertaken as part of the Prince of Wales's preparation for becoming king. The Prince of Wales engaged in this correspondence with ministers with the expectation that it would be confidential. Disclosure of the correspondence could damage the Prince of Wales's ability to perform his duties when he becomes king.

"It is a matter of the highest importance within our constitutional framework that the monarch is a politically neutral figure able to engage in confidence with the government of the day, whatever its political colour."

Katy Clark, a Labour MP who campaigns for an elected head of state, said she was appalled at the attorney general's decision, which she described as "quite shocking".

"The more you hear about the lobbying that Charles has undertaken over decades, the more inappropriate it seems," she said. "My concern is that government policy has been changed and it would seem to me that Prince Charles should not be allowed to hold undue influence over aspects of health policy and architectural policy where he has little experience."

Lord Rogers, the Labour peer and architect whose schemes have been previously torpedoed by the prince's private interventions, said he believed the government's decision would continue to allow the royal "to do the damage and disappear without a trace".

Rogers said: "It is either a democracy or it is not. I don't think anybody, be it a king, prince or poor man, has a right to undermine decisions by private interventions which have a public impact. The only way for Charles to be a public figure is for him to act publicly. It is not democratic to cover up his interventions."

He said the secrecy also clashed with Prince Charles's own claims that he represents a strand of public opinion. He said if he considered himself representative then those representations must be made in full view.

The judges on the information tribunal had ruled in favour of releasing the letters, stating: "The essential reason is that it will generally be in the overall public interest for there to be transparency as to how and when Prince Charles seeks to influence government."

They decided "it was fundamental" that the lobbying by the heir "cannot have constitutional status" and cannot be protected from disclosure.

The evidence, they said, showed "Prince Charles using his access to government ministers, and no doubt considering himself entitled to use that access, in order to set up and drive forward charities and promote views, but not as part of his preparation for kingship … Ministers responded, and no doubt felt themselves obliged to respond, but again not as part of Prince Charles's preparation for kingship."

Graham Smith, the director of Republic, a pressure group which is campaigning for greater transparency over royal engagement in politics said: "He clearly has something to hide and this is a coverup.

"In a very convoluted way, [Grieve] is saying it is in Charles's interests to use the veto and therefore it is in the public interest, which it isn't.

"There is no credibility to Grieve's remarks and he is simply making sure that Charles isn't exposed for lobbying government."