The National Enquirer’s parent company acknowledged paying hush money to a woman who alleged an affair with Donald Trump to “suppress the woman’s story” and “prevent it from influencing the election.”

The admission came as federal prosecutors announced Wednesday that they would not prosecute the company, American Media Inc. (AMI), for its role in a scheme to tilt the presidential race in favor of Trump. In the agreement, AMI said it would cooperate with prosecutors and admitted it paid $150,000 to Karen McDougal before the 2016 election to silence her allegations of an affair with Trump.

The deal signaled the unraveling of the deep relationship Trump and AMI chief executive David Pecker had forged over decades. The deal also made clear that Pecker, whose tabloid strongly supported Trump’s candidacy, has turned on the president.

AMI agreed to cooperate with the Southern District of New York in September, and the deal became public Wednesday as Michael Cohen, Trump’s longtime fixer, was sentenced for campaign finance violations for his role in arranging payments to McDougal and Stormy Daniels, the pornographic film star who also alleges an affair with Trump. The moves put additional pressure on the president as he faces multiple investigations and finds himself losing the protection of some of his long-standing allies.

According to the agreement, Pecker met with Cohen “and at least one other member of the campaign” in August 2015. “At the meeting, Pecker offered to help deal with negative stories about that presidential candidate’s relationships with women by, among other things, assisting the campaign in identifying such stories so they could be purchased and their publication avoided. . . . Pecker agreed to keep Cohen apprised of any such negative stories.”

Prosecutors also allege that Pecker and AMI played a key role in the effort to silence Daniels. One month before the election in 2016, after an agent for Daniels informed National Enquirer editor Dylan Howard that Daniels intended to tell her story publicly, Pecker and Howard contacted Cohen. Soon after, Cohen negotiated a $130,000 deal to buy Daniels’s silence.

Theodore Boutrous, a First Amendment attorney at Gibson Dunn who briefly represented McDougal, said the relationship between Trump’s associate and the tabloid publisher “was a shockingly creative plan meant to change the way American citizens voted. That is an important and serious violation of the law.”

Boutrous, who began looking into the National Enquirer’s role in protecting Trump in October 2016, said he always believed the tabloid “had teamed up with Donald Trump and his campaign to stop Ms. McDougal from speaking out, solely to protect Mr. Trump and help him get elected president. That seemed outrageous and illegal.”

For months, AMI denied that it had acted in concert with Trump’s campaign, initially saying “there was nothing sinister” about their actions, another of McDougal’s lawyers, Peter K. Stris, tweeted on Wednesday. “Today, the public has learned that AMI was lying.”

The Wall Street Journal reported the details of the National Enquirer’s payment to McDougal days before the 2016 election. At the time, AMI told the paper that it “has not paid people to kill damaging stories about Mr. Trump.”

AMI’s non-prosecution agreement includes both Pecker and Howard, also the company’s chief content officer, who said in a June interview that Trump “has never been consulted on editorial decisions — or by himself or through intermediaries requested an article be written on a given subject or angled in a certain way.”

A representative for AMI declined to comment.

The agreement suggests that Pecker, who has a long-standing relationship with Trump, is of ongoing use to prosecutors.

In 1997, when Pecker was running the U.S. arm of magazine publisher Hachette Filipacchi, he launched Trump Style, which was distributed in Trump properties. Pecker rented out facilities at Mar-a-Lago for AMI board meetings, and Trump introduced Pecker at Pace University when Pecker received an honorary doctorate.

Long before Trump announced his candidacy, Pecker was involved in his political ambitions. In 2011, AMI helped manage a website, www.­shouldtrumprun.com, which Cohen decided to launch with several partners.

“Pecker has a deep industrial knowledge of how Trump and Cohen operated,” said one former Enquirer staffer.

Two months after Trump announced his candidacy, Pecker, Trump and Cohen hatched a plan to help the campaign, according to prosecutors.

Charging documents filed against Cohen this summer say Pecker told Cohen that he would identify damaging stories about Trump and, when necessary, pay the sources involved to guarantee that they wouldn’t speak about them in public.

The tactic — an old one among members of the tabloid press — was known as “catch and kill.” Pecker reportedly kept documents related to damaging stories about Trump and other figures in a safe in his office.

AMI’s first known target on behalf of Trump was McDougal, a former Playboy centerfold model who claimed she had a long affair with Trump. The company paid her $150,000 for the “rights” to her story, which it then declined to publish.

The charging documents also allege that a few days after Daniels’s deal was arranged, on Oct. 25, 2016, Pecker and Howard warned Cohen, who hadn’t paid her yet, that she was close to selling her story to another publication. They urged him to finalize the deal.

Whether exposure of Daniels’s and McDougal’s stories would have changed the outcome of the 2016 election will probably be debated for years. But Cohen and Howard clearly considered the matter of great urgency. The payment to Daniels, in particular, came at a sensitive time — just days after Trump was hurt by the leak of a videotape in which he boasted about grabbing women’s genitals and amid news reports about women who claimed that Trump had sexually assaulted them years earlier.

The disclosure of consensual affairs — particularly one involving a porn star that allegedly took place only a few months after Melania Trump had given birth to Trump’s child — could have been a decisive blow, particularly in states that Trump won by just a few thousand votes.

Trump initially denied knowledge of the payments to Daniels and McDougal but said on Monday that the Daniels payoff was a “simple private transaction” that wasn’t an illegal campaign contribution, as federal prosecutors contend. He has also suggested that Cohen agreed to plead guilty to limit his prison sentence for unrelated financial crimes.

The Enquirer itself was deeply committed to promoting Trump’s candidacy. Editors and executives at AMI sent digital copies of the tabloid’s articles and cover images of Trump or his political opponents to Cohen in advance of publication, The Post has reported, citing the accounts of three people with knowledge of the matter.

Cohen’s guilty plea challenges Howard’s assertion earlier this year that Trump had no influence over the Enquirer’s coverage. “We do not run or kill stories on the behest of politicians, even if they are the president of the United States,” Howard said in April.