Washington: A federal judge on Monday dismissed the defamation lawsuit that Stormy Daniels filed against President Trump, saying his tweet attacking the porn star’s credibility was free speech protected by the Constitution.

“If this court were to prevent Mr Trump from engaging in this type of ‘rhetorical hyperbole’ against a political adversary, it would significantly hamper the office of the president,” Judge S James Otero of the US District Court in Los Angeles wrote in a 14-page ruling. “Any strongly-worded response by a president to another politician or public figure could constitute an action for defamation. This would deprive the country of the ‘discourse’ common to the political process.”

Otero’s ruling was a rare win for Trump in a seven-month legal battle with the adult film actress who says she had a one-night stand with him in 2006, a few months after his wife, Melania, gave birth to their son, Barron.

Otero ordered Daniels to pay Trump’s legal fees for his defence in the suit. The amount of the fees has not yet been determined, Trump lawyer Charles J Harder said.

“No amount of spin or commentary by Stormy Daniels or her lawyer... can truthfully characterise today’s ruling in any way other than total victory for President Trump and total defeat for Stormy Daniels,” Harder said.

The dismissal of the defamation case has no bearing on Daniels’ continuing legal fight to void the nondisclosure pact that bars her from speaking publicly about her alleged affair with Trump.

Daniels’ attorney, Michael Avenatti, filed a notice of appeal with the US 9th Circuit Court of Appeals.

“There is something really rich in Trump relying on the 1st Amendment to justify defaming a woman,” Avenatti said by email.

Trump’s April 18 tweet came after Avenatti made public a sketch of a man whom Daniels said had threatened her in 2011 if she spoke publicly about her alleged affair with Trump. The president has denied having sex with her.

Daniels, 39, whose real name is Stephanie Clifford, says the man walked up to her and her baby daughter in a Las Vegas parking lot and said it would be a shame “if something happened to her mom.” He told her to forget about Trump, Daniels said.

“A sketch years later about a nonexistent man,” Trump tweeted. “A total con job, playing the Fake News Media for Fools (but they know it)!”

Daniels and Avenatti have posed growing legal and political trouble for Trump since February. A lawyer for the Trump Organization, the president’s business empire, launched a secret arbitration proceeding threatening Daniels with millions of dollars in damages if she broke the October 2016 nondisclosure agreement.

Daniels quickly sued to nullify the pact, then told the full story of her alleged encounters with Trump on 60 Minutes. Since then, Avenatti, who is considering a run for president in 2020, has taunted Trump in hundreds of television appearances.

Under the confidentiality deal, Michael Cohen, then Trump’s personal lawyer and fixer, paid Daniels $130,000 (Dh477,416) to keep quiet. The Trump Organization reimbursed Cohen, who submitted invoices for legal services he never provided, prosecutors say.

When Cohen pleaded guilty in August to tax evasion, lying to a bank and breaking campaign finance laws, one of his admitted crimes was paying off Daniels in an attempt to influence the 2016 presidential election.

Cohen declared in court that Trump directed him to make the payoff. He is now cooperating with federal prosecutors.

Trump and Cohen, who is also being sued by Daniels, have now asked Otero to dismiss the case, saying they have abandoned efforts to enforce the nondisclosure agreement.

But Avenatti, recently branded by Trump as a “total low life,” is still seeking to depose the president about his knowledge of the hush money.

In his ruling on Monday, Otero said Daniels was a public figure and “political adversary” of Trump whose lawsuit challenged the legitimacy of his presidency by alleging he “aggressively sought to silence” her to ensure he won the election.

“Trump issued the tweet as a rejoinder against an individual challenging him in the public arena,” Otero wrote. “This is the definition of protected rhetorical hyperbole.”