President Donald Trump used Twitter on Thursday to assert that he is innocent after Michael Cohen, his former lawyer, said he violated campaign-finance laws at his boss' direction.

Trump said it was Cohen's own fault if he did anything illegal on Trump's behalf.

Justice Department veterans told INSIDER that Trump's defense, known as "advice of counsel," is a rarely invoked and rarely successful strategy.

The defense "doesn't apply if both the lawyer and the client are on the same page that what they are doing" could be illegal, one expert said.

If a client invokes the defense, it also means they waive attorney-client privilege, meaning Cohen could open up to prosecutors about any other legally problematic work he did for the president.

Prosecutors also have a mountain of evidence that appears to back up Cohen's claims.

As federal prosecutors encircle the White House, President Donald Trump used Twitter on Thursday to deny that he directed Michael Cohen, his former lawyer, to break the law, and said it was Cohen's own fault if anything he did on Trump's behalf was illegal.

"He was a lawyer and he is supposed to know the law," Trump said of Cohen. "It is called 'advice of counsel,' and a lawyer has great liability if a mistake is made. That is why they get paid."

He added in subsequent tweets: "Despite that many campaign finance lawyers have strongly stated that I did nothing wrong with respect to campaign finance laws, if they even apply, because this was not campaign finance. Cohen was guilty on many charges unrelated to me, but he plead to two campaign charges which were not criminal and of which he probably was not guilty even on a civil basis.

"Those charges were just agreed to by him in order to embarrass the president and get a much reduced prison sentence, which he did-including the fact that his family was temporarily let off the hook," Trump continued. "As a lawyer, Michael has great liability to me!"

Read more: Trump denies directing Michael Cohen to break the law, says it is Cohen's fault if anything illegal happened

Justice Department veterans told INSIDER that Trump's legal argument was shaky at best and that prosecutors had a mountain of evidence suggesting Trump directly played a role in Cohen's crimes.

Patrick Cotter, a former federal prosecutor who was part of the team that convicted the Gambino crime family boss John Gotti, said Trump's tweets represented a "standard, if not cliché, response of many persons accused of participation in or ordering a crime carried out by someone who has now confessed to the crime."

Jens David Ohlin, a vice dean at Cornell Law School who is an expert on criminal law, echoed that view. Trump's defense, known as "advice of counsel," is "rarely invoked and even less rarely successful," he told INSIDER.

In the Cohen case, it could hurt Trump in more ways than one.

The advice-of-counsel defense "doesn't apply if both the lawyer and the client are on the same page that what they are doing is illegal in some way," Ohlin said. "According to Cohen, both he and Trump understood that they were paying hush money to influence an election, and then covered it up to hide the illegality."

Moreover, when a client invokes the advice-of-counsel defense, they must waive attorney-client privilege.

"Does Trump really want to do that?" Ohlin said. "Everything that Cohen did for Trump would then be subject to inspection, which might open up new avenues of legal scrutiny. It would be a very risky litigation strategy."

Win McNamee/Getty Images

Prosecutors have corroborating evidence that could point to 'compelling evidence of a conspiracy'

Cohen pleaded guilty in August to several counts of tax evasion, bank fraud, and campaign-finance violations, which stemmed from two payments made to women who say they had affairs with Trump.

The first was to the former Playboy model Karen McDougal by American Media Inc., the parent company of the National Enquirer. The company spent $150,000 to purchase the rights to McDougal's account of a 10-month affair with Trump but never published her story. Cohen has said that both he and Trump were involved in coordinating the payment.

The second payment was $130,000 to the porn star Stormy Daniels in October 2016 to keep her from discussing what she says was a 2006 affair with Trump.

Trump's attorneys have argued that the payments were a "simple private transaction" and did not constitute campaign-finance violations because they were made to protect Trump's family and businesses. But Trump's lead defense attorney, Rudy Giuliani, has previously insinuated that if Daniels had broken her silence so close to the election, it could have swayed the outcome in Hillary Clinton's favor.

And the nonprosecution agreement that the Southern District of New York reached with AMI says the company "admitted that its principal purpose in making the payment" to McDougal "was to suppress the woman's story so as to prevent it from influencing the election."

Prosecutors also have a tape recording of Trump and Cohen discussing the payments and the setting up of shell companies, as well as referring to David Pecker, the head of AMI, who news reports have suggested has a history of burying potentially damaging stories about Trump.

Cohen's and AMI's admissions about the payments, moreover, were made under penalty of perjury.

"This is what prosecutors, jurors, and sentencing judges call 'compelling evidence of a conspiracy,'" Jeffrey Cramer, a longtime former federal prosecutor in Chicago, told INSIDER.

Read more: Federal prosecutors are blowing holes through all of Trump's defenses in the Michael Cohen case

Michael Cohen. AP Photo/Julie Jacobson

'Now they are caught'

Trump's tweets suggest that his defense against charges that he violated campaign-finance laws rests on the fact that he did not directly use campaign funds to pay off McDougal and Daniels.

But Cotter said this defense didn't apply in Trump's case. The president is not accused of using campaign funds to pay the women. His legal liability stems from prosecutors' findings that the payments exceeded legal contribution limits.

"The resulting illegal contribution was either made by Cohen or by Trump's private organization when they repaid Cohen," Cotter said. "That Cohen and Trump did not bother to pass the illegal contribution through the campaign bank accounts doesn't matter legally.

"Doing it the way they did simply made it a little harder to catch, as a 'contribution' in the amount of the payoffs directly to the campaign would have been immediately apparent as illegal," he added. "So they did it the way they did it. And now they are caught."