The actor is calculated to have earned around £24 million from the Potter franchise playing the character Ron Weasley.

Judge Barbara Mosedale described how Grint, 27, had followed advice from tax advisers Clay & Associates to change his accounting date so that 20 months of income would fall to be taxed in 2009-2010.

The judge said he wished to bring forward to the earlier year liability for payments on eight months' worth of income otherwise due in the tax year 2010-2011 - the year the top rate of tax rose from 40% to 50%.

The judge said if the date change had been accepted it would have led to a 10% saving on income - about £1m, according to Grint's accountants.

The 50p rate was brought in by the last Labour government in its final days in a bid to safeguard public finances in the wake of the banking crisis. It was abolished two years later.

Dismissing Grint's appeal, the judge ruled that he had failed to show a change had been effected under section 217 of the Income Tax (Trading and Other Income) Act 2005 because he did not have accounts showing the correct accounting period for the change.

The judge stressed it was not part of HMRC's case that Grint was involved in tax avoidance.

During the hearing of his challenge, Grint, who first appeared in the Potter films at the age of 12, had admitted that his knowledge of his financial affairs was "quite limited", and that he left his tax returns to his father, Nigel, and his accountant, Dan Clay.

The judge said in her ruling that he had made it clear "that he placed his faith in his father and accountants to deal with his financial affairs".