The chairman of the company that publishes the National Enquirer was granted immunity by federal prosecutors as part of an investigation into President Donald Trump's former personal lawyer, Michael Cohen, NBC News reported Thursday.

The immunity deal was earlier reported by The Wall Street Journal and Vanity Fair.

Details of the agreement were not immediately known. But the Journal reported earlier Thursday that American Media Inc. Chairman David Pecker had given prosecutors details about the president's knowledge of payments Cohen made to women alleging affairs with Trump.

Prosecutors declined CNBC's request for comment on the Journal's report. A spokesman for American Media did not immediately respond to CNBC's requests for comment.

The immunity deal could hold significant consequences for Trump, as Pecker could have as much damaging information about the president as anyone in Trump's orbit.

He and Pecker have been friends since the 1990s, and have appeared to remain so after Trump became president — the media mogul even visited the White House last year, according to The New York Times.

Pecker has also reportedly used his media holdings to shield Trump when the president was a New York real estate developer and reality television star. Pecker's publications have defended Trump as a presidential candidate, as well, including a reported effort during the 2016 election to stifle ex-Playboy model Karen McDougal's allegations of an affair with Trump.

Trump has been a public advocate for Pecker, too. In 2013, he tweeted several times urging Time Magazine to hire Pecker as its top executive. "Nobody could bring [the magazine] back like David!" Trump wrote in one of the tweets.

Pecker was subpoenaed by federal investigators in April, as were his company and the Trump Organization. The Journal said the subpoenas were served at the same time the FBI raided Cohen's office and residences, seizing electronics, recordings and thousands of documents.