WASHINGTON — A federal judge dismissed Stormy Daniels’ defamation lawsuit against President Donald Trump on Monday, saying the president made a “hyperbolic statement” against a political adversary when he tweeted about a composite sketch the porn actress’ lawyer released.

Daniels, whose real name is Stephanie Clifford, sued Trump in April after he said a composite sketch of a man she said threatened her in 2011 to keep quiet about an alleged affair with the real estate mogul was a “con job.”

Trump tweeted that the man was “nonexistent” and that Daniels was playing the “fake news media for fools.” He retweeted a side-by-side photo comparing the sketch with a photo of Daniels’ husband.

In an order handed down Monday, U.S. District Judge S. James Otero said Trump’s statement was protected speech under the First Amendment.

Daniels’ attorney, Michael Avenatti, vowed to appeal the decision and said he was confident it would be reversed.

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

But the president’s lawyer immediately hailed the ruling as a “total victory” for Trump.

“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,” Trump’s attorney, Charles Harder, said in a statement.

Daniels was paid $130,000 as part of a nondisclosure agreement signed days before the 2016 election and is suing to dissolve the contract. Daniels has argued the agreement should be invalidated because Trump’s personal lawyer and fixer, Michael Cohen, signed it, but Trump did not.

Lawyers for Trump and Cohen now say the deal that paid Daniels $130,000 to keep quiet was invalid, and they won’t sue her for breaking it. Trump’s attorney said the president never considered himself as a party to the agreement and doesn’t dispute Daniels’ assertion that the contract isn’t valid.

While Trump and Cohen want the court to toss out the litigation as moot, Daniels’ lawyer wants to keep the case alive.

That case, which is separate from the defamation claim, is continuing.

Associated Press writer Catherine Lucey contributed to this report.