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 relationship.

Federal District Judge S. James Otero in Los Angeles had indicated during a late September hearing that he was skeptical of Daniels's claim on First Amendment grounds. The ruling ordered Daniels, whose given name is Stephanie Clifford, to pay Trump's legal fees.

Trump attorney Charles Harder cheered Otero's decision and said the amount of legal fees owed would be determined later.

"No amount of spin or commentary by Stormy Daniels or her lawyer, Mr. Avenatti, can truthfully characterize 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's 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 tweeted.

"Trump's contrary claims are as deceptive as his claims about the inauguration attendance. We will appeal the dismissal of the defamation cause of action and are confident in a reversal," he tweeted.