David Pecker, the publisher of the National Enquirer and longtime friend of President Donald Trump, has been granted immunity by federal prosecutors in their investigation into Michael Cohen, a person with knowledge of the matter told NBC News on Thursday.

Cohen, Trump's former personal attorney, pleaded guilty Tuesday to eight counts of tax evasion, bank fraud and campaign finance violations, including two counts related to hush-money payments made to women that he said he made at the direction of Trump.

American Media, which publishes the National Enquirer, was referenced in court papers, along with a $150,000 payment made to ex-Playboy model Karen McDougal, who alleges she had an affair with Trump more than a decade ago.

Court documents say that American Media paid McDougal for the rights to her story in an attempt to keep her alleged relationship with Trump secret ahead of the presidential election. The arrangement is known as "catch and kill" — American Media acquires the exclusive rights to the story but never publishes it.

McDougal said she entered into the agreement with American Media shortly before the 2016 election that barred her from discussing the alleged affair; she has since sued American Media to void the agreement.

The Wall Street Journal first reported the granting of immunity to Pecker. The paper also said Pecker met with prosecutors to discuss the involvement of Cohen and Trump in making the payment.

A spokesperson for the U.S. Attorney's Office in New York declined to comment.

Pecker has a relationship with Trump dating back to the 1990s.

During the campaign, in March 2016, the Enquirer backed Trump for president — its first endorsement in its then-90-year history. In June, The Washington Post reported that the Enquirer regularly sent stories to Trump for review prior to publication, which the supermarket tabloid has denied.

Pecker also visited the White House last year and had a private dinner with the president, according to The New York Times.