Sir Gus O'Donnell, the cabinet secretary, blocked an attempt by Gordon Brown before the general election to hold a judicial inquiry into allegations that the News of the World had hacked into the phones of cabinet ministers and other high-profile figures.

As News International prepares to pay compensation to victims of the illegal practice, the Guardian understands that Britain's most senior civil servant took steps to prevent an inquiry on the grounds that it would be too sensitive before last year's general election.

The then prime minister, who warned Peter Mandelson in 2009 that his phone had been hacked on behalf of the News of the World, wanted a judicial inquiry after new evidence of the illegal practice emerged that summer.

The Guardian revealed in July 2009 that Rupert Murdoch's News Group newspapers had paid more than £1m to settle legal cases that threatened to reveal illegal phone hacking by private investigators on behalf of News of the World.

The revelations were of acute political sensitivity because Andy Coulson, editor of the News of the World between 2003 and 2007, was by then David Cameron's communications director. Coulson was asked to appear before the Commons culture select committee after the publication of the Guardian disclosures.

O'Donnell told Brown, who lost the support of the News of the World and its sister paper, the Sun, in the autumn of 2009, that it would be inappropriate to hold a judicial inquiry so soon before the election. Coulson was by then one of the most senior members of Cameron's inner circle and was appointed as the Downing Street director of communications after the general election. He has consistently denied any knowledge of wrongdoing, and resigned from No 10 in January saying coverage of phone hacking had made his job impossible.

The disclosure that O'Donnell blocked an inquiry came as Boris Johnson called for a "truth and reconciliation" commission to establish the full facts about phone hacking. In an interview on Sky News, the mayor of London said: "Plainly the police need to get on with it. But I would like to see the entire newspaper industry, what we used to call Fleet Street and indeed the media generally, have a general truth and reconciliation commission about all this. I think all the editors and all the proprietors should come forward, put their hands up, say whether they know of any of their reporters or employees who may or may not have been engaged in these practices which have now been exposed at the News of the World. I think that would be a very healthy development."

Johnson spoke out after News International issued a public apology on Friday to eight victims of phone hacking. These included the actor Sienna Miller, the former Labour culture secretary Tessa Jowell, the football agent Sky Andrew and the publicist Nicola Phillips.

Charlotte Harris of Mishcon de Reya, which represents Andrew, said she was advising her client not to accept compensation until he sees all the documentation in the possession of News International. Harris told Radio 4's The World This Weekend: "Sky Andrew has been finally offered an apology and we are thinking about what to do. There isn't actually a particular figure they have offered us for anything. The position Sky is taking is not disimilar to that of Sienna Miller and Nicola Phillips. It is: isn't this a bit early, we are just about to have disclosure of the documents, we need to have a look and see what has happened and get to the bottom of it and then we'll see where it goes from there."

Asked if she would advise her clients not to settle without disclosure of notes and emails, Harris said: "Yes. What we have at the moment is an apology and an admission, having been working on this for a very long time. We haven't even got near the truth yet. We have got orders that mean we are now going to be able to have a chance at getting to the bottom of it, so we need to find out. How are we meant to know what to accept if we don't know the full extent of what has happened?"

Harris added that thousands of phones could have been monitored. "If you consider that if you hack into one person's phone, you have access to everyone who has left a message for them. And then, if you go into the person who has left a message, you get all of theirs. You have got to be running into several thousand, just from that methodology. To put a figure on it, it is certainly not a handful - maybe 4,000, 6,000, 7,000 - a huge amount of people."The Guardian understands Gordon Brown was so concerned that News of the World was targeting Labour figures that he warned Peter Mandelson his phone had been hacked. Mandelson approached the information commissioner, but he did not confirm that his phone had been hacked.

Critics of Murdoch have urged the government not to decide on his bid to take control of BSkyB until the allegations have been fully investigated. But advisers to the culture secretary, Jeremy Hunt, say he is prevented by law from taking the scandal into account when he considers whether it is appropriate for News Corporation to be allowed to buy all of BSkyB. The £8bn merger, which the minister has already said he is minded to approve, is being examined on its impact on "media plurality". However, Hunt's lawyers say that phone hacking cannot be considered in an inquiry as regards plurality. They say it could only form part of a "suitability of persons" test into whether Murdoch and the bosses of News Corporation were appropriate individuals to own BSkyB. That test was designed to prevent pornographers, for example, becoming media owners - but it cannot now be invoked in the case of the Murdoch merger. The Enterprise Act that covers the UK's merger rules only allows one referral on one set of grounds, which means £8bn deal could only ever have been referred for political approval on either media plurality or suitability of persons grounds, but not both.

A Cabinet Office spokeswoman said: "We never comment about any advice from a cabinet secretary to a prime minister on any issue."