Palace officials feared Prince Charles would be attacked if he walked behind Princess Diana’s coffin at her funeral in 1997 in the wake of the emotional public outpouring surrounding her death.

The sensational revelation was made by former Downing Street spin doctor Alastair Campbell in extracts from his new book, published in the Guardian.

The former governement head of communications also revealed that Prince William, then aged 15, was asked to walk behind Princess Diana’s coffin with his father to mitigate the possibility of such an attack.

In his new book Power and The People, Campbell says senior courtiers at Balmoral, along with the Queen and Duke of Edinburgh raised concerns over Prince Charles safety in a conference call.

Prince Charles’s press secretary, Sandy Henney, was then despatched to Balmoral to convince William that his mother would have wanted him to follow her coffin at her funeral.

But William was initially reluctant to agree, writes Campbell.

“William was refusing to speak to anyone and he was consumed by a total hatred of the media.”

According to Campbell, the Queen’s deputy private secretary, Sir Robin Janvrin, said that if William did not follow Princess Diana’s coffin, “then Charles couldn’t ‘for obvious and understandable reasons'”.

“They realised that if William doesn’t go behind the coffin, they have a real problem because Charles would have to go behind the coffin with [Diana’s Brother] Charles Spencer,” Campbell wrote.

But Prince William eventually came around and Diana’s funeral, which saw William and Prince Harry walk behind the coffin with Prince Charles, Earl Spencer and Prince Phillip took place on September 6 1997.