British judges can continue to impose "whole life" prison sentences in the most heinous cases of murder, the court of appeal has ruled.

The appeal judges confirmed that a European court of human rights ruling last year (pdf) that such whole life sentences needed to be reviewed at some stage does not prevent murderers being sent to prison for the rest of their lives in the most serious cases.

The appeal court judges, led by the lord chief justice, said the European human rights judges had been wrong to say British law did not clearly provide whole life inmates with any possibility of release and said that such a power clearly existed in exceptional circumstances.

The ruling (pdf) increases the 40-year sentence on Ian McLoughlin, the murderer of Graham Buck, to a whole life prison term after an appeal by the attorney-general, Dominic Grieve, that it was unduly lenient.

The appeal court also dismissed a challenge in a second case brought by killer Lee Newell against his whole life order for the murder of Subhan Anwar.

The ruling clears the way for sentencing in a number of high-profile murder cases that had been put on hold pending its outcome. They include the prison terms to be handed out to Michael Adebolajo and Michael Adebowale, who were convicted in December of killing Fusilier Lee Rigby in Woolwich, south-east London, in May last year.

The justice secretary, Chris Grayling, welcomed the decision. He said: "Our courts should be able to send the most brutal murderers to jail for the rest of their lives. I think people in Britain will be glad that our courts have disagreed with the European court of human rights, and upheld the law that the UK parliament has passed."

The attorney-general welcomed the court's decision to declare the 40-year sentence passed on McLoughlin, aged 55, as "unduly lenient" for such a heinous crime and impose a whole life term instead: "As someone who has killed three times, Ian McLoughlin committed just such a crime, and following today's judgment he has received the sentence that crime required.

"I asked the court of appeal to look again at McLoughlin's original sentence because I did not think that the European court of human rights had said anything which prevented our courts from handing down whole life terms in the most serious cases.

"The court of appeal has agreed with me and today's judgment gives the clarity our judges need when they are considering sentencing cases like this in the future."

The lord chief justice, Lord Thomas, said McLoughlin and Newell were two exceptional and rare cases of second murders committed by people who were already serving life sentences for murder: "It is likely to be rare that the circumstances will be such that a whole life order is required. Our decision on each case turns on its specific facts and cannot be seen as a guide to any similar case."

The need to clarify the legal status of whole life sentences followed the sentencing of McLoughlin last October at the Old Bailey when Mr Justice Sweeney imposed a minimum sentence of 40 years. The Old Bailey judge said he had to take account of the European court of human rights ruling last July that the whole life sentences passed on three killers, Douglas Vintner, Jeremy Bamber and Peter Moore, amounted to inhumane and degrading treatment because it lacked any formal review mechanism that would give any prospect of release. They said such sentences had to be reviewed at some stage, and suggested 25 years, but said that it was up to national authorities to decide.

The lord chief justice said it was clear the Old Bailey judge had been in error in thinking that he did not have the power to give a whole life order.

The five appeal court judges, including Thomas, ruled that Strasbourg had been wrong to state that whole life prisoners had no hope of release. They pointed to section 30 of the Crime (Sentences) Act, which provides for the "possible exceptional release of whole life prisoners", saying it did provide that prospect.

"In our judgment the law of England and Wales therefore does provide to an offender 'hope' or the 'possibility' of release in exceptional circumstances which render the just punishment originally imposed no longer justifiable," said the lord chief justice.

He said it was consistent with the rule of law that such requests should only be considered on an individual basis. However, the judges said they found it difficult to specify what such exceptional circumstances might be.

The effect of the appeal court ruling is to restore the position before the Strasbourg ruling last July. Justice ministers are expected to use it to back their argument with the European human rights court that they will not grant an automatic right of review of the whole life sentences currently imposed on 53 of the most heinous killers in jails in England and Wales.

Jill Lorimer, a criminal law specialist at Kingsley Napley, said although the appeal court might face criticisms of judicial lawmaking it had found a solution that might allow the UK to comply with the Vinter ruling without a protracted political wrangle.

A spokesman for the Council of Europe, which oversees the European court of human rights, confirmed that there was now a disagreement with the British judiciary over whether the existing law clearly provided for the release of whole life prisoners in exceptional circumstances.

"The UK court of appeal has agreed with the ECHR that whole life sentences are not incompatible with the [human rights] convention, but disagreed that the existing laws allowing for release in exceptional circumstances are unclear and sought to clarify what the law is."

He said that the Council of Europe's committee of ministers was now overseeing the implementation of the original Vinter judgement. The British government had submitted "an action plan" to do that on 9 January and said it would provide further information as soon as possible.