A federal judge dismissed a lawsuit from adult film actress Stormy Daniels that claimed President Donald Trump defamed her. Picture: AP Photo/Markus Schreiber, File

Washington - A federal judge on Monday dismissed a lawsuit from adult film actress Stormy Daniels that claimed President Donald Trump defamed her when he suggested she had lied about being threatened to keep quiet about their alleged relationship.

US District Judge James Otero in Los Angeles ruled that Trump's speech was protected by the First Amendment as the kind of "'rhetorical hyperbole' normally associated with politics and public discourse in the United States." He ordered Daniels, whose given name is Stephanie Clifford, to pay Trump's legal fees.

Trump attorney Charles Harder cheered Otero's decision.

"No amount of spin or commentary by Stormy Daniels or her lawyer, Mr. Avenatti, can truthfully characterise today's ruling in any way other than total victory for President Trump and total defeat for Stormy Daniels," Harder said in an emailed statement.

The ruling is a blow for Daniels and her lawyer, Michael Avenatti, who has raised a national profile from his legal battles against the president and is contemplating a presidential bid in 2020.

Avenatti called the ruling "limited" on Twitter and said it did not affect Daniels' primary case against Trump and his former attorney Michael Cohen, which seeks to invalidate her 2016 nondisclosure agreement.

"Daniels' other claims against Trump and Cohen proceed unaffected," Avenatti wrote in a tweet he later appeared to have deleted.

He said in a second tweet that any fees Trump might be awarded from the defamation case would "be dwarfed by the fees he and Cohen will be required to pay in connection with the NDA case."

Later, Avenatti tweeted that he had appealed Otero's ruling to the Ninth Circuit Court of Appeals.

The now-dismissed suit has received less attention than two other cases pending against Trump-Daniels' lawsuit seeking to void the nondisclosure agreement and a separate defamation claim by former Apprentice contestant Summer Zervos, who alleges that Trump sexually assaulted her in 2007 and argues that he defamed her when he suggested she was lying.

Trump was ordered last month to provide written answers under oath in that case, which is proceeding in New York State Supreme Court.

Avenatti and Daniels have joined the ranks of Trump's chief antagonists since the beginning of this year, when Daniels' nondisclosure agreement was first reported. The deal was brokered in the lead-up to the 2016 election to stop Daniels from speaking about a brief affair she says she had with Trump in 2006. Trump denies that an affair took place.

Trump and Cohen have sought to prevent further litigation over the NDA by promising not to enforce it. The two sides will appear before Otero on Dec. 3 to argue about whether that lawsuit should proceed.

Daniels filed the defamation claim in April after she released a sketch purporting to show the man she says threatened her in 2011 to keep quiet about the alleged affair.

Responding to the sketch on Twitter, Trump wrote that it depicted a "nonexistent man."

"A total con job, playing the Fake News Media for Fools (but they know it)!" he wrote in the tweet, which became the basis of Daniels's suit.

Otero, who was appointed to the court by President George W. Bush, had indicated during a late-September hearing that he was skeptical of Daniels' claim on free-speech grounds. He argued Monday that Daniels has presented herself as Trump's "political adversary" in public and in court filings and that Trump has the right to respond to her claims.

"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," Otero wrote.

"Any strongly-worded response by a president to another politician or public figure could constitute an action for defamation. This would deprive this country of the 'discourse' common to the political process," he wrote.