WASHINGTON – A federal judge in California on Monday dismissed a defamation lawsuit adult film star Stormy Daniels filed against President Donald Trump, ruling the president's criticism of Daniels was protected by the First Amendment.

Daniels, whose real name is Stephanie Clifford, filed the suit in April after Trump described her as a "con job" in a Twitter post. The president was reacting to a claim by Daniels that a man threatened her over her allegations of a sexual encounter with Trump 12 years ago.

U.S. District Court Judge S. James Otero indicated during arguments last month that he believed the tweet by Trump appeared to be protected speech. In his ruling Monday, Otero described it as a hyperbolic statement aimed at a public figure.

The judge's ruling also ordered Daniels to pay Trump's legal fees.

More:Judge appears likely to toss out Stormy Daniels' libel case against Trump

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

Michael Avenatti, Daniels' attorney, filed an appeal to the 9th Circuit Court of Appeals soon after Otero’s ruling.

"Trump’s contrary claims are as deceptive as his claims about the inauguration attendance," Avenatti posted on Twitter. "We will appeal the dismissal of the defamation cause of action and are confident in a reversal."

In another tweet, Avenatti said, "Be clear - even assuming Trump is owed attys fees from the defamation case (if he wins the appeal), they will be dwarfed by the fees he and Cohen will be required to pay in connection with the NDA case. Not even close. Yet more 'winning' from Trump."

The case is separate from another pending suit Daniels filed to invalidate a non-disclosure agreement she said she signed in exchange for $130,000 to keep quiet about her alleged affair with Trump. The president has denied the affair, and his attorneys said in September they don't intend to enforce the agreement.

More:President Trump won't enforce hush-money contract with Stormy Daniels

Daniels' defamation case stems from remarks she made in television interviews alleging that a man confronted and threatened her over her allegations against Trump. Daniels unveiled a sketch in April on ABC's The View of the man she said threatened her.

Trump responded with a tweet describing the person in the sketch as a “non-existent man” and described Daniels as a “total con job.”

More:Porn actress Stormy Daniels sues President Trump for defamation

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