WASHINGTON — President Donald Trump's longtime lawyer, Michael Cohen, secretly recorded a conversation with Trump two months before the presidential election in which they discussed payments to a former Playboy model who said she had an affair with Trump, according to lawyers and others familiar with the recording.

The FBI seized the recording this year during a raid on Cohen's office. The Justice Department is investigating Cohen's involvement in paying women to tamp down embarrassing news stories about Trump before the 2016 election. Prosecutors want to know whether that violated federal campaign finance laws, and any conversation with Trump about those payments would be of keen interest to them.

The recording's existence further draws Trump into questions about tactics he and his associates used to keep aspects of his personal and business life a secret. And it highlights the potential legal and political danger that Cohen represents to Trump. Once the keeper of many of Trump's secrets, Cohen is now seen as increasingly willing to consider cooperating with prosecutors.

Rudy Giuliani, Trump's personal lawyer, confirmed in a telephone conversation Friday that Trump had discussed the payments with Cohen on the tape but said the payment was ultimately never made. He said the recording was less than two minutes and demonstrated that the president had done nothing wrong.

"Nothing in that conversation suggests that he had any knowledge of it in advance," Giuliani said, adding that Trump had directed Cohen that if he were to make a payment related to the woman, write a check, rather than sending cash, so it could be properly documented.

"In the big scheme of things, it's powerful exculpatory evidence," Giuliani.

Cohen's lawyers discovered the recording as part of their review of the seized materials and shared it with Trump's lawyers, according to three people briefed on the matter.

"We have nothing to say on this matter," Cohen's lawyer, Lanny J. Davis, said when asked about the tape.

The former model, Karen McDougal, says she began a nearly yearlong affair with Trump in 2006, shortly after Trump's wife, Melania, gave birth to their son Barron. McDougal sold her story to The National Enquirer for $150,000 during the final months of the presidential campaign, but the tabloid sat on the story, which kept it from becoming public. The practice, known as "catch and kill," effectively silenced McDougal for the remainder of the campaign.

David J. Pecker, chairman of The Enquirer's parent company, is a friend of Trump's, and McDougal has accused Cohen of secretly taking part in the deal -- an allegation that is now part of the FBI investigation.

When The Wall Street Journal revealed the existence of the payment days before the election, Trump's campaign spokeswoman, Hope Hicks, said, "We have no knowledge of any of this." She said McDougal's claim of an affair was "totally untrue."

By Matt Apuzzo, Maggie Haberman and Michael S. Schmidt