Former children's services chief Sharon Shoesmith has lost her High Court battle over her sacking following the death of Baby P.
Mr Justice Foskett, sitting in London, rejected accusations that her removal by Children's Secretary Ed Balls was procedurally flawed, unfair and unlawful.
Ms Shoesmith said her career had been ruined by a media witch-hunt and "flagrant breach of the rules of natural justice".
The 57-year-old was sacked from her £130,000-a-year post as director of children's services at Haringey Council in north London in December 2008 following a damning report by Ofsted inspectors.
Ofsted's lead inspector, Heather Brown, described the quality of practice in Ms Shoesmith's department as the "worst I had ever seen".
Baby Peter was just 17 months old when he died in August 2007 at the hands of his mother Tracey Connelly, her lover Steven Barker and their lodger, Barker's brother Jason Owen. He had suffered 50 injuries despite receiving 60 visits from social workers, doctors and police over the final eight months of his life.
Sharon Shoesmith's legal team said documents released after the main hearing of her legal challenge at London's High Court showed Ofsted rewrote the report under political pressure to make it more critical of her. Ofsted officials denied the allegations.
The High Court was told Ms Shoesmith was "shocked" by her "unlawful and unfair" treatment. She received death threats and thought of suicide for the first time in her life.
A series of reviews identified missed opportunities when officials could have saved the little boy's life if they had acted properly on the warning signs in front of them.
Lawyers for Mr Balls argued Ms Shoesmith was "ultimately responsible" for the "shambolic, disturbing state of affairs" in Haringey's children's services department.