MI5 warned the cabinet secretary in the 1980s about rumours that a minister had a “penchant for small boys” but did not inform the police or launch an investigation into the allegations, according to a member of the security services.

Giving evidence anonymously to the independent inquiry into child sexual abuse (IICSA), a lawyer with the security service apologised for it having taken a “narrow, security-related view” of the accusations against Sir Peter Morrison.

“With hindsight,” the lawyer, whose voice was heard via remote video link, said “it was a matter of deep regret” that MI5 had not cooperated with police or made inquiries into the activities of the former MP for Chester, who died in 1995.

The official said the security service did not investigate people merely because they had a public profile but only when there was reason to suspect they posed a threat to national security. Not all files were “adverse”, he added, saying that some might be opened if a person was targeted by a terrorist group or could be susceptible to approaches by a foreign intelligence organisation.

A letter from the then head of MI5, Sir Antony Duff, to Sir Robert Armstrong, the then cabinet secretary, that was sent in 1986 was read out to the inquiry. It said that stories about Morrison, who was then minister of state for trade and industry, “persist”.

A member of MI5, Duff wrote, had heard from two sources that Morrison had “a penchant for small boys”. The source was understood to be Donald Stewart, the Conservative party agent for Westminster.

The security service was not sure whether it was based on rumours previously aired in 1983 or on more recent events. Duff ended the letter saying: “I would just as soon that we didn’t get involved for the time being.”

An internal MI5 memo in November 1986 from Eliza Manningham-Buller, later director general of the security service, said she had seen Morrison and his family the previous night for dinner and he had told her that the prime minister was supporting him. Morrison said he hoped the press would publish so that he could sue and “nail the lies”.

The security service also recorded reports that Morrison had been picked up for importuning. Manningham-Buller, who is due to appear before IICSA on Tuesday, has told the inquiry that she was not the member of MI5 staff who had first heard the rumours against Morrison, who later became parliamentary private secretary to Margaret Thatcher.

Brian Altman QC, counsel to the inquiry, suggested that the statement that Thatcher knew about the allegations against Morrison and was nonetheless supporting him depended entirely on the MP’s version of events. The MI5 lawyer agreed that appeared to be so.

“Wasn’t the obvious route,” Altman suggested, “that an inquiry should have been made of Sir Robert Armstrong to ask if the prime minister was supporting Morrison in those terms?” The service had been “rather blinkered” about the proper approach, he added.

The inquiry also heard evidence about MI5’s investigation into the activities of Sir Peter Hayman, a former high commissioner to Canada, who retired in 1984 and died in 1992.

He kept detailed diaries about his sex life which were seized when his flat in Bayswater, central London, was raided. The director of public prosecutions (DPP) later gave MI5 access to them.

The security service interviewed Hayman’s friends and then him, particularly about reports that in the 1950s when he was in Baghdad local boys had visited him for sexual purposes. The DPP, Hayman told MI5, had given him immunity from prosecution.

The outcome of the investigation, the MI5 lawyers said, was that Hayman had rendered himself vulnerable to blackmail but that there had been no actual prejudice to security.

The MI5 officer was also taken through a list of prominent individuals whose activities had raised questions about child abuse. Among them was Maurice Oldfield, a former head of MI6, who had told Thatcher that he had had “homosexual encounters”, dating back to the 1940s and 1950s, with “house boys” and “hotel stewards” in Asia.

Allegations against the former home secretary Leon Brittan were said to have come only from a disgruntled prisoner who resented having been denied parole.

The agency’s records, the inquiry was told, also mentioned unsubstantiated allegations against the former Conservative MPs Christopher Chataway, Charles Irving and Sir William van Straubenzee. All have since died. It is not clear whether any information on them was ever passed to police.

Additional reporting by Charlotte King