President Trump’s wall of secrecy — the work of a lifetime — is starting to crack.

His longtime lawyer, Michael Cohen, pleaded guilty last week to breaking campaign-finance laws and said he had arranged hush-money payments to two women at Trump’s direction. A tabloid executive — who had served Trump by snuffing out damaging tales before they went public — and Trump’s chief financial officer gave testimony in the case.

All three had been part of the small circle of family, longtime aides and trusted associates who have long played crucial roles in Trump’s strategy to shield the details of his personal life and business dealings from prying outsiders.

But, as their cooperation with prosecutors shows, a growing number of legal challenges — including the Russia investigation by special counsel Robert S. Mueller III and a raft of lawsuits and state-level probes in New York — is eroding that barrier.

The result has been a moment in which Trump seems politically wounded, as friends turn and embarrassing revelations about alleged affairs and his charity trickle out, uncontained. In coming months, certain cases could force Trump’s company to open its books about foreign government customers or compel the president to testify about his relationships with ­women.

“The myth of Trump is now unraveling,” said Barbara Res, a Trump Organization executive from 1978 to 1996. “He’s becoming more obvious, and people are starting to know what he’s like and what he’s doing.”

Whether the president faces legal peril is not clear, but his presidency is at a precarious point. Recent polls suggest his repeated attacks on Mueller for leading a “witch hunt” have lost their effectiveness. And if the Democrats win a majority in at least one house of Congress in the midterm elections, now less than 10 weeks away, they would gain the power to investigate or even impeach.

“The whole reason he is freaking out is, he can’t get rid of any of this,” said a longtime adviser to Trump, who, like others interviewed for this story, spoke on the condition of anonymity to discuss internal White House dynamics.

The president’s sense of betrayal came through last week when he derided cooperating witnesses as “flippers.” “Everything’s wonderful and then they get 10 years in jail and they — they flip on whoever the next highest one is, or as high as you can go,” he told Fox News. In contrast, he tweeted that his “brave” former campaign chairman, Paul Manafort, who was convicted last week of bank fraud and tax fraud, had “refused to ‘break.’ ”

Trump has also focused his ire on Attorney General Jeff Sessions, whom he has repeatedly and publicly attacked for his decision to recuse himself from the Russia investigation. White House aides have explained to him that firing Sessions would not end the probe, but he remains livid, officials said, particularly after Sessions responded last week with a statement declaring that “the actions of the Department of Justice will not be improperly influenced by political considerations.”

The Trump Organization declined to comment for this story. The White House referred questions to Trump’s outside lawyers, who also declined to comment for this story.

Before this year, any explanation of Trump’s secrecy would have begun with Cohen, a lawyer who threatened reporters with lawsuits for writing about Trump.

Before last week, it would have begun with Allen Weisselberg, the Trump Organization’s longtime chief financial officer.

If Cohen was the outside man, Weisselberg has been the insider: a functionary whom Trump trusted to handle his company’s bills and his charity’s donations. Weisselberg started out working for Trump’s father, decades before.

“They are the same family,” Weisselberg and the Trumps, said one person close to the Trump Organization. “I think Allen has earned that. He’s been around a long time, and he’s part of the family.”

They helped build a world where Trump was the only reliable source of information about his finances. Although Trump bragged often about his wealth and business success, he avoided releasing hard evidence when he could.

In one case, he seemed to reject the idea of evidence itself. What was Trump’s net worth? It was whatever he said it was.

“My net worth fluctuates, and it goes up and down with markets and with attitudes and with feelings, even my own feelings,” Trump said in a 2007 deposition, after he had sued reporter Tim O’Brien for publishing an independent estimate of Trump’s value. The suit was dismissed.

When Trump entered politics, he encountered a new level of scrutiny.

While much attention focused on his refusal to release his tax returns, a break from modern-day presidential practice, last week’s court proceedings revealed more details about other ways Trump the candidate sought to control his image.

Charging documents in the Cohen case said the Trump Organization had authorized payments to Cohen totaling $420,000 after ­Cohen paid for the silence of a woman who alleged an affair with Trump.

Weisselberg approved the payments as a fee for a “legal retainer,” according to one person familiar with his role. It was not clear, from court documents, whether he knew that explanation was a sham. A person familiar with the situation said Weisselberg did not know the nature of the settlement and approved the reimbursement because of Cohen’s long-standing role as counsel to Trump.

In pleading guilty, Cohen said in court that he had made these decisions “in coordination with” Trump and at his direction. That included paying the woman, which was an illegal campaign contribution.

Prosecutors also said in their court filings that Trump relied during his campaign on an ally: David Pecker, the chief executive of American Media Inc., which owns the National Enquirer.

Pecker turned his company from a spiller of secrets to a keeper of them, prosecutors said. In at least one case, the company paid a woman who alleged she had an extramarital relationship with Trump. Then it didn’t publish a thing.

Weisselberg and Pecker, who in addition to Cohen had been bulwarks of Trump’s secrecy, received immunity to testify about Cohen’s actions. It is unclear whether that was the limit of their cooperation, to testify about Cohen, or whether prosectors have asked broader questions about Trump or his company.

An AMI lawyer did not respond to requests for comment from Pecker. Neither Weisselberg nor company representatives responded to requests for comment on his behalf.

For his years as a businessman and as a candidate, Trump’s system was effective — though not perfect — at repelling inquiries from reporters. But once he became president, Trump began to face a new kind of inquiry, from people with lawsuits and ­subpoenas.

Now, there are at least seven of those inquiries, all asking for some kind of information about Trump or his company.

On the investigative front, Mueller has delved deeply into Trump’s campaign and White House, asking whether the campaign coordinated with Russian efforts to influence the election and whether Trump obstructed justice to stop or slow the probe.

Already, four associates of Trump’s 2016 campaign have pleaded guilty or been convicted as a result of Mueller’s work, which is ongoing. Mueller has also probed some aspects of Trump’s business specifically related to Russia, notably efforts undertaken by Cohen to launch a Trump Tower Moscow project during the campaign.

The Cohen case, meanwhile, led by federal prosecutors in Manhattan, has pointed to potential legal liability for Trump and his company, experts have said — though Trump and his lawyers have attacked Cohen in recent days as an unreliable witness.

If prosecutors conclude that Trump himself did something illegal, it’s unclear what they would do.

The Justice Department has official guidance saying that a president cannot be indicted while in office because that would impermissibly interfere with the executive’s ability to carry out duties under the Constitution. But a president might be named as an “unindicted co-conspirator” in a grand jury report, or investigators could compile evidence that Congress might use in an impeachment case.

In addition to those federal investigations, the New York attorney general has already filed suit against Trump, alleging “persistently illegal conduct” at his charity, the Donald J. Trump Foundation. That case relied on internal documents provided by Trump’s company and testimony from Weisselberg, who handled the foundation’s books.

Now, the state is investigating whether to file criminal charges in that case.

And beyond that, Trump is facing several lawsuits that could pry further into his business and his personal life.

The attorneys general of Maryland and the District sued him, saying he violated the Constitution’s “emoluments clauses,” which bar presidents from taking payments from foreign governments or U.S. states.

The plaintiffs say those clauses should prevent Trump’s company — which he still owns — from doing business with foreign officials. They’ve already won some preliminary victories in court. And they want to soon begin searching Trump Organization records, including those of his luxury D.C. hotel that has become a popular destination for Trump ­allies and political groups.

In addition, a group of Democratic members of Congress has filed an emoluments lawsuit, while the New York attorney general is considering one of her own, focused on Trump’s businesses there.

Meanwhile, Summer Zervos, a former contestant on “The Apprentice,” Trump’s reality TV show, has sued him for defamation. Zervos alleges that Trump aggressively kissed her and groped her when she was seeking a job at his company and that he defamed her by later denying that account and calling her a liar.

More legal challenges could ­follow.

One candidate for New York attorney general, Zephyr ­Teachout (D), is running this year on promises to investigate the Trump Organization aggressively if she’s elected.

“The line between [the company and the Trump campaign], which should be absolute looks deeply blurred and raises all kinds of questions about civil and criminal violations,” Teachout said after Cohen’s guilty plea.

At the Trump Organization, people close to the company said, the impact of these investigations has been to overburden the legal staff. Company attorneys are also dealing with more mundane challenges, such as a new lawsuit in Illinois alleging that Trump Tower in Chicago is violating environmental laws meant to protect the Chicago River.

Inside the White House, the impact of these inquiries and the intense media coverage has been to set Trump fuming about ­disloyalty.

The revelations about his aides’ cooperation with prosecutors, ­after all, had emerged in the immediate aftermath of the publication of a tell-all book by one of his former White House aides. Omarosa Manigault Newman, a Trump ally from her days as a star on “The Apprentice,” had flipped in her own way — declaring Trump unfit for the presidency and using her frequent national television appearances to roll out her collection of secret recordings from inside the West Wing.

Trump has complained to advisers about Cohen, saying he could not trust anyone. He has been distracted in meetings, polling staff about developments in legal cases, several aides said.

He grew concerned that White House counsel Donald McGahn had turned on him, advisers said, after the New York Times reported he had sat for 30 hours of questions. He complained about Sessions, his attorney general, on Twitter and on television.

Trump has long seen any investigative interest in his business as a step too far, West Wing advisers say, and allies said he was frustrated by the intrusions into his life before the presidency.

“If they did it to anybody in business in our country, they’d find some jaywalking on technicalities,” said John Catsimatidis, a Trump friend and New York billionaire who is critical of the investigation.

In one possible sign of the strain this week placed on Trump, the president fired off an all-caps tweet that denounced the investigations against him. “NO COLLUSION - RIGGED WITCH HUNT!” Trump wrote, on the second day after Cohen’s guilty plea.

The time of that tweet: 1:10 a.m.

josh.dawsey@washpost.com

rosalind.helderman@washpost­.com

Carol D. Leonnig, Jonathan O’Connell, Devlin Barrett and Sarah Ellison contributed to this report.