President Donald Trump with Melania Trump at a Playboy party in 2001. MediaPunch/AP

When the FBI raided President Donald Trump's longtime personal attorney's office and residences, agents were looking for records of payments to two women who say they had affairs with Trump, according to The New York Times.

The agents, whose actions were ordered by the Justice Department, were also looking for information about the role of the publisher of the National Enquirer in keeping one of the women quiet, The Times said.

The documents sought relate to the former Playboy model Karen McDougal and the porn star Stormy Daniels.

Citing several people briefed on the investigation, The Times reported that the agents, whose actions were approved by the Justice Department, were looking for documents related to Karen McDougal, a former Playboy model who says she had a nine-month affair with Trump a decade ago, and to Stormy Daniels, the porn star who says she had a sexual relationship with Trump in 2006 while he was married.

Cohen, Trump's longtime personal attorney and confidant, has said that shortly before the 2016 election he made a $130,000 payment to Daniels, whose real name is Stephanie Clifford, to ensure her silence. He says the money was his own.

Trump, who denies having had any relationship with Clifford or McDougal, has said that he did not know about the payment and that he does not know where Cohen got the money.

According to The Times, the search, orchestrated by the public-corruption unit of the Manhattan federal attorney's office, also targeted information related to a $150,000 payment to McDougal from American Media Inc., which owns the National Enquirer.

In August 2016, McDougal signed an agreement to sell American Media Inc. the exclusive rights to her story. But the company, which has a history of publishing stories favorable to Trump and whose CEO is a friend of the president's, killed the story.

"We never printed a word about Trump without his approval," a former top editor at the company told The New Yorker.

McDougal told The New Yorker that she regretted selling her story to the Enquirer, saying, "It took my rights away."