WASHINGTON — The man who once derived his identity from making President Trump’s problems go away turned on his former boss in stunning fashion Wednesday, alleging to Congress that Trump manipulated financial records, paid to cover up extramarital affairs and reacted with glee upon learning the WikiLeaks anti-secrecy organization would release emails damaging to his political opponent.

Michael Cohen, Trump’s former fixer and personal lawyer, cast the president as a mendacious and petty racist who enlisted those around him to propagate a culture of deceit, in business, during his campaign and after winning the White House. In testimony before the House Oversight Committee, Cohen revealed how, in his view, Trump broke the law even as president, and he suggested ominously that federal prosecutors remain interested in a case involving the president.

“Is there any other wrongdoing or illegal act that you are aware of regarding Donald Trump that we haven’t yet discussed today?” Rep. Raja Krishnamoorthi, D-Ill., asked.

“Yes, and again, those are part of the investigation that’s currently being looked at by the Southern District of New York,” Cohen responded.

A spokesman for the U.S. attorney’s office in Manhattan declined to comment.

Cohen hinted repeatedly at possible legal jeopardy for the president, saying he is willing to tell all now out of fear that if Trump were to lose the 2020 election, “there will never be a peaceful transition of power.”

“My loyalty to Mr. Trump has cost me everything,” Cohen said. “I will not sit back, say nothing and allow him to do the same to the country.”

Some of Cohen’s claims were backed by evidence, while others will hinge on his admittedly poor track record for reliability. Cohen is facing a three-year prison sentence that is scheduled to begin in May, in part for having lied previously to Congress.

Michael Cohen, former attorney to President Trump, testifies before the House Oversight Committee on Wednesday in Washington. The Washington Post/Matt McClain

The president and his Republican allies sought to portray Cohen as a fabulist, disgruntled because Trump wouldn’t give him a job in the White House and now hoping to get rich with a possible movie or book deal arising from specious claims about the president and those closest to him.

“You’re a pathological liar. You don’t know truth from falsehood,” said Rep. Paul Gosar, R-Ariz., who also jeered Cohen with the schoolyard chant “liar, liar pants on fire.”

“No one should ever listen to you and give you credibility,” he added.

Trump, who is in Vietnam for a highly anticipated summit with North Korean leader Kim Jong Un, tweeted before Cohen’s testimony began that his one-time confidant was “lying in order to reduce his prison time,” though the White House was largely quiet otherwise.

In a calm, measured tone, Cohen alleged that Trump inflated his assets so he’d be known as a wealthy man and deflated them for tax purposes, and offered records he said proved his point.

Former U.S. attorney Barbara McQuade, who watched the hearing, said she believed Cohen “shared some evidence of bank and tax fraud.”

Cohen alleged Trump was a “racist” who once declared that “black people would never vote for him because they were too stupid.”

He also asserted that Trump knew in advance that WikiLeaks planned in July 2016 to release a batch of emails damaging to Hillary Clinton. Cohen testified that he overheard a phone call from Trump’s longtime friend Roger Stone in which Stone allegedly informed Trump he had spoken by telephone with WikiLeaks founder Julian Assange and learned that the anti-secrecy group would be publishing a “massive dump” of Clinton emails within days.

Cohen said he could hear the conversation because Trump had put Stone on speaker phone – a common practice of Trump’s, he said – and estimated that the call took place on July 18 or 19, 2016. Trump, Cohen alleged, responded, “Wouldn’t that be great.”

Prosecutors have said that on July 18, WikiLeaks confirmed to an online persona operated by Russian military intelligence officers that it had received the stolen material and would make the documents public that week. On July 22, WikiLeaks published thousands of internal emails from the Democratic Party, documents that prosecutors have said were provided to the group by Russian operatives.

The allegation, which has never before been aired publicly, goes to the heart of special counsel Robert Mueller III’s investigation of Russian interference in the election and contradicts repeated claims by both Stone and Trump, who have said they had no advance knowledge of WikiLeaks’ plans.

Trump has said, too, that he never discussed WikiLeaks with Stone.

WikiLeaks wrote on Twitter that Assange “never had a telephone call with Roger Stone.” Likewise, in a text message, Stone said, “Mr. Cohen’s statement is not true.” He has previously told The Washington Post that the two “never discussed WikiLeaks.”

Stone was indicted in January as part of the special counsel investigation, charged with seven counts of lying to Congress and obstruction of justice. The special counsel did not allege that Stone spoke to Assange or that he gave Trump advance knowledge of WikiLeaks’ plans. Cohen said he was not sure how to corroborate his allegation, and he stopped short of accusing Trump of conspiring with Russia to influence the election – though he noted Trump was “all about winning and will do what is necessary to win.”

“No single thing Cohen said about Trump related to Russia is a smoking gun,” said Robert Weisberg, a professor of criminal law at Stanford University. “But, pulled together, they could become a thread used to charge someone with being a co-conspirator.”

Recognizing his credibility would be called into question, Cohen came to the hearing with records he hoped would support his explosive assertions. Most notable, he provided lawmakers with two checks – one dated Aug. 1, 2017, which he said was signed by the president; the other from March 17, 2017, which he said was signed by Donald Trump Jr., the president’s son, and Allen Weisselberg, the Trump Organization’s chief financial officer.

Cohen said the checks – which lawmakers flashed on screen in the committee room – were used to reimburse him because he had paid adult film actress Stormy Daniels $130,000 to keep quiet about an alleged extramarital affair with Trump. Cohen has claimed he made the payment, and helped arrange a similar one to another woman alleging an affair, at Trump’s direction. He has admitted that doing so violated campaign finance laws.

On Wednesday, Cohen emphasized that the “coverup” of that crime continued when Trump was president, and he alleged that Trump asked him to lie not just publicly about the matter, but to Trump’s wife. He alleged Trump even once called him and handed the phone to first lady Melania Trump so that Cohen would deny the allegations.

“Not only did I lie to the American people, I lied to the first lady,” Cohen said.

Cohen testified that he spent years fixing or averting problems for Trump – threatening, allegedly at Trump’s direction, the president’s high school, his colleges and the college board if his grades or SAT scores were ever released, and lying even when Trump did not outright tell him to do so.

Cohen said, notably, that Trump did not tell him to lie to Congress about a possible Trump Tower project in Moscow that Cohen pursued into the heart of the campaign. Cohen pleaded guilty last year to misleading lawmakers about the timing of the project – claiming discussions about it ended earlier than they actually did. BuzzFeed News reported in January that Trump had “personally instructed” him to lie, prompting an unprecedented statement from Mueller’s office disputing the report.

But Cohen said that he knew the message Trump wanted to send generally on his dealings with Russia, because Trump had allegedly told him things including, “Michael, there’s no Russia, there’s no collusion, there’s no involvement, there’s no interference.” He recalled a May 2017 meeting with Trump and his lawyer, Jay Sekulow, in which the president allegedly said, “It’s all a witch hunt. . . . This stuff has to end.”

Sekulow, Cohen alleged, was involved in editing what would turn out to be Cohen’s false congressional testimony – though his precise role was not immediately clear. At one point, Cohen said, the changes had to do with “the length of time that the Trump Tower Moscow project stayed and remained alive,” though later he said he would have to look at the document he submitted to describe Sekulow’s precise edits.

In response, Sekulow said, “Today’s testimony by Michael Cohen that attorneys for the President edited or changed his statement to Congress to alter the duration of the Trump Tower Moscow negotiations is completely false.”

The document was shared with Sekulow and Abbe Lowell, the lawyer for Trump son-in-law Jared Kushner and daughter Ivanka Trump, as part of a joint defense agreement, Cohen said.

“At the end of the day,” Cohen said of Trump, “I knew exactly what he wanted me to say.”

Cohen accused the president of lying about negotiations over the Trump Tower Moscow project, saying he briefed Trump on the deal’s progress, even as the president claimed publicly to have no business interests in Russia. Cohen said he also briefed two of Trump’s children, Donald Jr. and Ivanka, about the project’s status, and that he talked with then-Trump campaign manager Corey Lewandowski about possible business travel to Russia. The project was never undertaken.

Cohen hinted – but provided no conclusive evidence – that Trump might have known in advance about his son Donald’s June 2016 meeting with a Russian lawyer, another focus of Mueller’s investigation.

Trump and Donald Trump Jr. have repeatedly denied that the then-candidate knew about the meeting, which Trump’s son accepted after he was told the lawyer would bring incriminating information about Clinton. Cohen said he witnessed Trump Jr. enter his father’s office sometime in early June 2016 and tell him in a low voice, “The meeting is all set.” But Cohen acknowledged he did not know for certain the cryptic comment’s meaning.

In other moments, Cohen shot down dark allegations that have long circulated about Trump.

He said he had no knowledge of any compromising salacious material held by the Russians, as alleged in a dossier written before the election by a former British spy. Cohen also said he has never been to Prague, knocking down another allegation in the dossier that he visited the European city to meet with Russian operatives in the fall of 2016. (Cohen told The Post in January 2017 that he had been to Prague once – around 2002, when he drove through the city but did not stop.)

He said he did not believe there is a rumored video of Trump striking his wife in an elevator, and that he was confident Trump would not hurt his wife.

Cohen closed his remarks with a lengthy statement aimed directly at the president, criticizing Trump for insulting veterans, kowtowing to American adversaries, alienating U.S. allies, bullying dissenters and disrespecting Gold Star families.

“I am not protecting Mr. Trump anymore,” he told the committee.