Prince Harry and six other public figures face paying up to £34.5m to the publisher of the Daily Mail after a High Court judge imposed an exceptional order for legal costs over their failed privacy case.

The seven claimants, also including Sir Elton John and Liz Hurley, must pay an initial £9.54m by Friday of next week to Associated Newspapers Limited (ANL).

The judge ruled that the case was a rare one in which the claimants should have to pay far in excess of the costs that had been agreed before trial, criticising how they presented their claims as “unreasonable to a high degree”.

On 7 July, Judge Mr Justice Nicklin dismissed the claims of unlawful information-gathering, which ANL denied.

The Duke of Sussex and the other six claimants have until 2 October to attempt to launch an appeal.

Those other claimants are Sir Elton John and his husband David Furnish, former Liberal Democrat deputy leader Sir Simon Hughes, racial justice campaigner Baroness Lawrence, and actresses Sadie Frost and Liz Hurley,

They had insurance to cover up to £16.2m of Association Newspapers’ costs in the event of losing the case – but Friday’s ruling means the newspaper group could now try to recover up to the £34.5m that it said it had to spend to defend itself. This means the duke and others could face a bill of some £18m.

Justice Nicklin said: “I regard a claim for costs in excess of £34 million as, on its face, excessive and as giving rise to real concerns as to whether all of the costs now claimed by Associated were reasonably incurred and are reasonable in amount.”

But he added he had “decided not to impose a ceiling on Associated’s recoverable costs”, as it would “be too broad-brushed, would risk unfairness, and would be vulnerable to the charge that it was arbitrary”.

The judge also ruled that ANL’s costs should be determined on an indemnity basis, which is more favourable to the publisher in terms of the amount it can recover, aside from where orders had already been made.

He added it was “striking” that “not a single allegation of serious wrongdoing was voluntarily withdrawn” by the group of seven claimants.

He said: “That matters. Serious allegations of criminality or grave impropriety cannot properly be left hanging over individuals in that way.

“If a party no longer advances such an allegation, or no longer has a proper evidential basis for advancing it, the allegation should be withdrawn clearly and in terms.