BBC Scotland’s Head of News said they did “the right thing” by revealing that detectives were investigating Sir Cliff Richard and searching his home following a child sex assault allegation.

Gary Smith told Mr Justice Mann, the BBC could have been accused of not reporting a matter of high public interest because the singer was a high-profile figure.

He said that journalists had a responsibility to report such stories and public interest reporting often involved revealing things a famous name would prefer the public did not hear.

Mr Smith, who was UK news editor for BBC News at the time of the search and is now the corporation’s head of news and current affairs in Scotland, outlined his thoughts yesterday during the latest stage of a High Court trial in London.

Sir Cliff, 77, has sued the BBC over coverage of the South Yorkshire Police search in August 2014 and wants damages at the “top end” of the scale.

He says the coverage, which involved the use of a helicopter, was a “very serious invasion” of his privacy.

The BBC disputes his claims.

Mr Smith said discussions relating to coverage of a police search at Sir Cliff’s home nearly four years ago had taken place against a backdrop of the history of the “Jimmy Savile allegations”.

Mr Smith, who was UK news editor for BBC News at the time of the search and is now the BBC’s head of news and current affairs in Scotland, yesterday outlined his thoughts during the latest stage of a High Court trial in London.

Mr Smith said one consideration had been whether it would have been right to withhold information the BBC had.

He said: “These discussions took place against the backdrop of (the) history of the Jimmy Savile allegations and knowledge within institutions which had not been made public. An important factor in the editorial discussions about naming individuals who were the subject of police investigations was the issue of the media not reporting information it knew to be correct.”

He added: “The BBC could have been accused of not reporting a matter of high public interest because Sir Cliff Richard was a high-profile public figure.”

Mr Smith went on: “This was not a matter where we would have sought Sir Cliff’s consent to run the story. It is obvious he would not have consented. The media’s public interest reporting often involves telling the public something that a public figure would prefer the public not to hear.”

Mr Smith said the BBC had reported investigations into a number of high-profile figures, including entertainer Rolf Harris, publicist Max Clifford, presenter Paul Gambaccini and comedian Jimmy Tarbuck.

He said those reports had not attracted legal complaints over breach of privacy.

Mr Tarbuck and Mr Gambaccini had been investigated and arrested but not charged, he said, while Harris and Clifford were convicted of sexual offences.

“Sir Cliff Richard would have been the biggest household name to be under investigation,” he said.

“I say this in the sense that he was and is a high-profile public figure whose public status went beyond his success as an entertainer. He was known for his charitable work and was ‘part of the establishment’ in many ways.”

Mr Smith was appointed head of news at BBC Scotland in 2015, replacing John Boothman.

The 54-year-old grew up in Glasgow and attended Kelvinside Academy in the west end of the city.

Mr Smith studied English at Glasgow University and did a post-graduate journalism course at Cardiff University.