Federal investigators have provided ample evidence that President Donald Trump was involved in deals to pay two women to keep them from speaking publicly before the 2016 election about affairs that they said they had with him.

But it turns out that Trump wanted to go even further.

He and his lawyer at the time, Michael Cohen, devised a plan to buy up all the dirt on Trump that the National Enquirer and its parent company had collected on him, dating back to the 1980s, according to several of Trump’s associates.

The existence of the plan, which was never finalized, has not been reported before. But it was strongly hinted at in a recording that Cohen’s lawyer released last month of a conversation about payoffs that Cohen had with Trump.

“It’s all the stuff — all the stuff, because you never know,” Cohen said on the recording.

The move by Trump and Cohen indicated just how concerned they were about all the information amassed by the company, American Media, and its chairman, David Pecker, a loyal Trump ally of two decades who has cooperated with investigators.

It is not clear yet whether the proposed plan to purchase all the information from American Media has attracted the interest of federal prosecutors in New York, who last week obtained a guilty plea from Cohen over a $130,000 payment to the adult film actress Stephanie Clifford, also known as Stormy Daniels, and a $150,000 payment to a Playboy model, Karen McDougal.

But the prosecutors have provided at least partial immunity to Pecker, who is a key witness in their inquiry into payments made on behalf of Trump during the 2016 campaign.

The people who knew about the discussions would speak about them only on condition of anonymity.

Lawyers for Trump and Cohen declined to comment, as did American Media.

It is not known how much of the material on Trump is still in American Media’s possession or whether American Media destroyed any of it after the campaign. Prosecutors have not said whether they have obtained any of the material beyond that which pertains to McDougal and Clifford and the discussions about their arrangements.

For the better part of two decades, Pecker had ordered his staff at American Media to protect Trump from troublesome stories, in some cases by buying up stories about him and filing them away.

In August 2016, American Media acquired the rights to McDougal’s story in return for $150,000 and commitments to use its magazines to promote her career as a fitness specialist. But American Media never published her allegations about a relationship with Trump.

Shortly after American Media completed the arrangement with McDougal at Trump’s behest, a troubling question began to nag at Trump and Cohen, according to several people who knew about the discussions at the time: What would happen to America Media’s sensitive Trump files if Pecker were to leave the company?

“I need to open up a company for the transfer of all of that info, regarding our friend David,” Cohen says in a recording he made of his conversation with Trump.

The plan got far enough along that Cohen relays that he had discussed paying for all the information from American Media with the Trump Organization’s chief financial officer, Allen Weisselberg.

“I’ve spoken to Allen Weisselberg about how to set the whole thing up,” he says, adding about Pecker, “We’ll have to pay him something.”

In the end, the deal never came together.