In August 2015, David Pecker and Michael Cohen hatched a plan to help a mutual friend in need.

Donald Trump had launched his improbable presidential campaign just two months earlier. His relationship with New York tabloids had been legendary through two divorces. Embarrassing stories about the former reality-show star were a regular occurrence.

But now Trump was in a crowded primary against establishment Republicans. Pecker, the chief executive of a tabloid publishing company; Cohen, Trump’s personal lawyer; and at least one member of the Trump campaign came up with a system that month to bury negative stories about the candidate, according to charging documents made public in connection with Cohen’s guilty plea Tuesday.

According to the documents, Pecker assured Cohen that he would help deal with rumors related to Trump’s relationships with women by essentially turning his tabloid operation into a research arm of the Trump campaign, identifying potentially damaging stories and, when necessary, buying the silence of the women who wanted to tell them.

The charging documents allege that Pecker and his company, American Media Inc., owner of the National Enquirer, were more deeply and deliberately involved in the effort to help the Trump campaign than was previously known. AMI also played a key role in the effort to silence adult-film star Stormy Daniels, prosecutors allege.

Pecker and AMI did not respond to requests for comment Wednesday. Nor did Cohen or his attorney.

The documents do not name many of the individuals involved other than Cohen, but their identities are clear from the descriptions and what is publicly known of the events in question.

Prosecutors said their evidence includes records seized from AMI.

Details of AMI’s involvement in the Trump campaign have been leaking out for months, and the publisher’s effort to buy the rights to former Playboy model Karen McDougal’s story of an affair with Trump has been challenged in open court. But Cohen’s plea to campaign finance and other violations offered striking new insights about AMI’s role in the Daniels case.

On Oct. 8, 2016, the charging documents say, after an agent for Daniels informed Dylan Howard, an editor at the tabloid company, that she intended to tell her story publicly, Pecker and Howard contacted Cohen. Within days, Cohen negotiated a $130,000 deal to buy her silence, the documents say.

On Oct. 25, 2016, after Cohen did not execute the payment, Pecker and Howard warned him that Daniels was close to selling her story to another publication and urged him to finalize the deal.

On that day, Trump was campaigning in Florida, still on the ropes after a videotape emerged of him boasting about grabbing women’s genitals, leading several women to come forward with claims of sexual misconduct from years ago.

“I’ll tell you what — the media, folks, is no good,” Trump told a rally in Sanford. “They’re no good; very dishonest.”

But that night, Howard was reaching out to warn Cohen about Daniels’s plans. “We have to coordinate something” to resolve the situation, Howard texted, “or it could look awfully bad for everyone,” according to the charging documents. Howard and Pecker then called Cohen on an encrypted phone application, and he agreed to pay Daniels, the documents say.

Howard did not respond to a message seeking comment.

That the tabloid publisher and editor would intervene to stop a story from being published elsewhere — a story they apparently did not intend to publish — shows the unusual extent to which AMI worked to protect Trump.

“The Cohen information vindicates what we said from Day 1: AMI is a corporate shill posing as a media organization,” said Peter Stris, the attorney who represented McDougal in her lawsuit against AMI this year. “It worked secretly with Michael Cohen to illegally silence Karen McDougal on Trump’s behalf. And that should deeply trouble all Americans, regardless of their politics.”

The Washington Post has reported that National Enquirer executives sent digital copies of the tabloid’s articles and cover images related to Donald Trump and his political opponents to Cohen in advance of publication, citing the accounts of three people with knowledge of the matter. In April, Howard denied that the tabloid did so or that Trump had 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 at the time.

Through his guilty plea, Cohen implicated Pecker in an arrangement that Cohen said was illegal.

Yet legal experts interviewed Wednesday said such cases are difficult to prove and they thought it unlikely that prosecutors would pursue campaign finance charges against AMI or its executives. The prosecution of former senator and presidential candidate John Edwards on similar campaign finance allegations fell apart in 2012, as many jurors doubted the government had proved that he and an aide tried to cover up his extramarital affair simply to protect his presidential campaign. Edwards’s attorneys said that he worked to conceal the relationship to protect his marriage.

Trump attorney Rudolph W. Giuliani expressed similar skepticism in an interview Wednesday, saying that he saw no legal exposure for Trump or for AMI. He also suggested that Cohen agreed to plead guilty to limit his prison sentence for more serious financial crimes.

“It doesn’t amount to a crime or a campaign finance violation because it’s a personal expenditure,” Giuliani said. “The whole thing amounts to the same arguments made in the Edwards case, which went down in flames.”

For Enquirer staffers, the irony of the Edwards comparison is thick. The Enquirer led coverage of Edwards’s “love child” long before mainstream publications followed the story. Enquirer staffers took great pride in their leading role.

In 2011, Edwards was indicted on six counts of conspiracy and campaign finance fraud. He was accused of violating election law, criminally conspiring with donors to protect his presidential campaign by accepting hundreds of dollars in donations above the federal contribution limit to conceal his extramarital affair and his mistress’s pregnancy. The money was used to pay for her living and medical expenses, prosecutors alleged.

But jurors were not persuaded that the payment was an illegal campaign contribution. Edwards was acquitted on a charge of accepting illegal campaign contributions that were related to payments made after he dropped out of the race, and the jury deadlocked on the rest of the charges.

“In both situations, the theory is that it may not be a traditional contribution, but it’s something of value that is given for the purpose of influencing an election — the definition of campaign contribution under the law,” said Justin Shur, former deputy chief of the Justice Department’s Public Integrity unit, who litigated the Edwards case.

Charlie Spies, a lawyer who represented Republican presidential nominee Mitt Romney in 2008, said any analysis of AMI’s liability in a campaign finance case depends on whether prosecutors can prove that the corporation was seeking to influence the 2016 election. If Trump had a history of paying women to buy their silence in the past, for example, that would weaken the case.

“Any case against AMI would go to the issue of intent, which will be very hard to prove,” Spies said. “Presumably they have the resources to fight any prosecution attempt in a manner that Michael Cohen was not able to.”

The question is not whether AMI was a booster of Donald Trump’s. That it was is clear from a casual perusal of National Enquirer covers leading up to the election.

In an interview Wednesday, one former AMI staffer recalled that in the fall of 2015, not long after the August meeting with Cohen, Howard traveled to the AMI archives in Boca Raton and returned to New York with boxes of back issues, some of which included old Hillary Clinton stories that would later prove useful as the Enquirer turned his front pages over to stories that attacked Clinton and Trump’s other opponents on a regular basis.

In the National Enquirer newsroom on Wednesday, one staffer who spoke on the condition of anonymity to speak freely summed up the mood among reporters there: “The feeling is total embarrassment.”

Michelle Lee contributed to this report.