Robert Quick, formerly Britain's top counter-terrorism officer, has alleged that his senior Scotland Yard colleagues buckled under Conservative party pressure and withdrew their support for the investigation of a Tory frontbench spokesman who had received leaks which endangered national security.

Quick told the Leveson inquiry on Wednesday that the arrest in 2008 of the Conservative immigration spokesman, Damian Green, sparked outrage from senior Tories and Conservative-leaning papers. Quick said the furore led the then acting Metropolitan police commissioner, Sir Paul Stephenson, to ask him to halt the criminal investigation.

Quick alleged that Green had not just received the leaks but encouraged a civil servant to pass on information that might have endangered national security.

He said his investigation began after a complaint from the government that material had been stolen from the safe of the then home secretary's private office. Green, who is now an immigration minister, was arrested in November 2008 by Scotland Yard.

The arrest and search of Green's House of Commons office was condemned by David Cameron, then leader of the opposition, and London mayor Boris Johnson, who is now in control of setting the Met budget and strategic priorities, as well as having the power to fire the commissioner.

Christopher Galley, a civil servant, was also arrested. The Crown Prosecution Service decided in April 2009 not to prosecute Green or Galley.

Quick said that Galley phoned Green after being released and was told he should "plead not guilty and 'do not mention David Davis'", the senior Tory whom Galley had first contacted offering to leak information to embarrass the Labour government.

Quick said he had thoroughly checked the law at every stage and had the support of Stephenson before the arrest. But after the Tory explosion of anger, the acting commissioner withdrew his support, Quick claimed.

The row erupted weeks after London's Tory mayor had in effect fired Sir Ian Blair as Met commissioner.

Quick told the inquiry that Stephenson "looked anxious" and claimed he had written his resignation letter after Tory criticism of Green's arrest. The Met claims that Stephenson, who went on to be appointed commissioner, had in fact written a statement saying he would leave the force in April when his contract expired.

Quick agreed with Leveson's suggestion that dropping the inquiry would give the appearance at least of caving in to political pressure.

The officer said Stephenson asked him to stop the inquiry: "I expressed the view that I did not think it justifiable or ethical to stop the investigation purely on the basis of a controversy that appeared not to be driven by the public, but by those who may have a vested interest in deterring the police from undertaking such investigation."

Quick claimed Tory-supporting papers smeared him, he suspects with help from a senior police insider. He said he had been forced to move his children out of his home amid security fears after the Mail on Sunday published details about a wedding car business run by his wife, Judith, and staffed by former police officers.

Stephenson and Dick Fedorcio, head of press at Scotland Yard, had failed to try to intervene to stop the paper publishing the story, Quick claimed.

Quick apologised in December 2008 after claiming the Tories and their supporters were "mobilised … in a wholly corrupt way" against his investigation into Green's relationship with the Home Office civil servant.

Counsel to the inquiry Robert Jay QC said: "It all suggests a campaign from whoever to smear you in relation to the Green inquiry, to use a range of strategies."

Quick said that during the Green saga he came to believe some press leaks were so well informed that someone senior at Scotland Yard must have been briefing the media to undermine the investigation.

A report from Her Majesty's Inspectorate of Constabulary said the use of police resources in the Green investigation was "debatable", while an internal police review said Green's arrest was "not proportionate".

Quick, then head of counter-terrorism and an assistant commissioner, resigned from the Met in April 2009 over a separate mistake, when he was photographed entering No 10 with a briefing note on counter-terrorism on display.

At the Leveson inquiry, he claimed that the former assistant commissioner John Yates had resisted an attempt to examine his phone records over allegations he was leaking information from the cash for honours investigation, saying he was "very well connected".

Quick, then chief constable of Surrey, said he was called in to review the criminal investigation led by Yates. He gave it a clean bill of health but, in January 2007, Quick was called in again after Britain's top civil servant, Gus O'Donnell, complained that the police were leaking details to the media. O'Donnell specifically named Yates as the source of the leaks from the investigation into the then Labour government.

Quick alleged that Stephenson, the then Met deputy commissioner, did not implement his recommendation that the phone records of Yates should be examined for evidence of whether he was leaking against the Labour government.

Quick alleged that he clashed with Yates over this suggestion and that Yates told him: "No Bob, I am very well connected." Quick told Leveson his review found no evidence implicating Yates as the leaker: "I sensed Assistant Commissioner Yates was clearly sensitive – as I think I would be – to an intrusive process like that."

Last week, Yates in his evidence denied leaking information about the cash for peerages investigation, saying some of the most sensitive information gathered by police is still not known to the public.

Quick said Yates's media contacts troubled him, especially after he saw him having a drink with a Daily Mail crime journalist, Stephen Wright, whose paper was, he said, trying to "demolish" the then commissioner Sir Ian Blair. Quick said this contact was "extraordinary".

In 2000, Quick, then part of Scotland Yard's anti-corruption command, wanted to investigate newspapers after a covert operation revealed corrupt payments to police officers for information.

Quick added that it struck him at the time as possible that newspaper organisations were aware of the reasons for the payments and were themselves complicit in making corrupt payments to police officers.

His report was submitted to his then boss, Andy Hayman, but no action was taken, the inquiry heard.

Quick also said it was clear in 2000 that tabloid journalists, most likely with their bosses' blessing, were bribing officers: "There were considerable grounds to believe that journalists from tabloid newspapers were corruptors."