A High Court judge was wrong to bar publication of a behind-closed-doors ruling relating to the murder of six-year-old Ellie Butler, a judicial head has said.

Lord Dyson, the Master of the Rolls and the second most senior judge in England and Wales, said on Friday that Mrs Justice Pauffley had "reached the wrong conclusion" when deciding that the ruling should stay under wraps.

The ruling had been made by Mrs Justice Eleanor King following a private hearing in the Family Division of the High Court in the summer of 2014 - after Ellie had died but before her father Ben Butler was convicted of her murder.

Butler beat Ellie to death in a violent rage in their home in Westover Close, Belmont, in October 2013.

Earlier this summer Mrs Justice Pauffley, who also sits in the Family Division of the High Court, rejected an application from several media organisations who argued that publication of Mrs Justice King's ruling would be in the public interest in the wake of Butler's conviction.

Mrs Justice Pauffley concluded Mrs Justice King's ruling should not be published in case reporting prejudiced any retrial.

Butler is appealing his conviction and life sentence for killing Ellie.

But three Court of Appeal judges have over-ruled Mrs Justice Pauffley.

Lord Dyson, who headed the appeal panel and is the head of civil justice in England and Wales, said there is "no real possibility" that publication would prejudice Butler's rights to a fair retrial.

"[Mrs Justice Pauffley] reached the wrong conclusion," Lord Dyson said in a written Court of Appeal judgment.

"Even if there is a retrial, there is no real possibility that the publication of the [King ruling] will prejudice the rights of Mr Butler to a fair trial."

He added: [(Mrs Justice Pauffley] acknowledged that, in the event of a retrial, the risk of prejudice to its fairness occasioned by the publication of the [King ruling] was 'small'. In my view, it was so negligible that it should have been given little or no weight."

The other two appeal judges, Lord Justice McFarlane and Lord Justice Burnett, said they agreed.

The three appeal judges have said lawyers should check to ensure any material which identifies Ellie's younger sibling was taken out of Mrs Justice King's ruling before it was made public.

Editors from the Guardian, Daily Mail, Telegraph and Times newspapers plus bosses from the BBC, ITN and Sky News had asked for Mrs Justice King's ruling to be published.

Barrister Jude Bunting, who represented the media organisations, argued that Mrs Justice Pauffley had made the wrong decision at a Court of Appeal hearing earlier this month.

Butler was convicted in June of having murdered murdering Ellie, following a trial at the Old Bailey, and was given a minimum 23-year jail term.

Ellie's mother, Jennie Gray, was sentenced to 42 months in prison after being convicted of child cruelty. She had admitted perverting the course of justice.

A number of family court judges, including two High Court judges based in the Family Division, have overseen private hearings about Ellie, who was placed in the care of her grandparents after Butler was accused of shaking her when she was a baby.

She had been returned to the care of Butler and Gray following a ruling by Mrs Justice Hogg in 2012.

Mrs Justice King analysed issues in 2014 following Ellie's death.

Social services bosses at the London Borough of Sutton, who had responsibility for Ellie's welfare, had asked the judge to make ''findings of fact'' to help staff take decisions about the future of a younger sibling.

Mrs Justice King, who is now a Court of Appeal judge, concluded that, on the balance of probabilities, Butler was ''responsible for Ellie's death''. The judge said Ellie had suffered a skull fracture.

But her full ruling was not revealed.

Mrs Justice Pauffley had forecast that Mrs Justice King's ruling would make ''front-page news'' if published.

The judge had said that arguments in favour of publishing the King ruling were ''powerful and strong''.

But she said publication was likely to generate ''very extensive'' reporting and she decided the ruling should remain under wraps in case of ''any potential for a re-trial''.

Lord Dyson said appeal judges took a different view and had decided to allow an appeal by the media organisations.

Lord Dyson listed a number of concerns, saying: "[Mrs Justice Pauffley] failed to take into account (i) the fact that the jury would be directed to ignore anything they read or heard outside the trial and that it should and would be trusted to follow the directions given by the trial judge; (ii) the fact that broadcasting and newspaper editors should be trusted to behave responsibly; and (iii) the fade factor (it would be many months and possibly more than a year before a re-trial would take place).

"If [Mrs Justice Pauffley] had properly taken these factors into account, she would have been bound to conclude that the (King ruling) should be put into the public domain.

"Mr Bunting [made] the further valid point that it is difficult to see how the publication of [King ruling] could create a separate substantial risk of prejudice given that much of what appears in it is already in the public domain."