A U.S. judge on Monday dismissed adult film actress Stormy Daniels’s defamation lawsuit against President Donald Trump and ordered her to pay his attorney’s fees, saying a tweet the president had written referring to her was protected by free-speech laws.

U.S. District Judge S. James Otero issued the order Monday in Los Angeles.

Daniels alleges she had an affair with Trump in 2006 and sued him in April.

The lawsuit came after Trump tweeted about a composite sketch of a man Daniels says threatened her in 2011 to keep quiet about an alleged affair.

He called it a 'total con job.'

Trump and his wife, First Lady Melania Trump, returned to the White House on Monday after a trip to the Southeast U.S., where they surveyed the damage left by Hurricane Michael.

In dismissing the suit, the judge said Trump's tweet was a 'hyperbolic statement' against a political adversary.

A federal judge has dismissed porn actress Stormy Daniels' defamation lawsuit against President Donald Trump. Daniels is seen above in Berlin on Thursday

Daniels alleges she had an affair with President Trump (seen above at the White House with First Lady Melania Trump on Monday) in 2006 and sued him in April

Daniels, who has also sued over a $130,000 hush money agreement over the alleged encounter, sued over the tweet, claiming it made her appear to be a liar.

Attorneys for Trump have sought to dismiss both lawsuits.

'The Court agrees with Mr. Trump’s argument because the tweet in question constitutes "rhetorical hyperbole" normally associated with politics and public discourse in the United States,' Otero wrote.

The lawsuit came after Trump tweeted about a composite sketch of a man Daniels says threatened her in 2011 to keep quiet about an alleged affair

'The Court agrees with Trump’s argument because the tweet in question constitutes "rhetorical hyperbole" normally associated with politics and public discourse in the United States,' the judge wrote

'The First Amendment protects this type of rhetorical statement.'

Otero presides over both lawsuits.

Trump's lawyer, Charles Harder, said it was a 'total victory' for the president.

He said the amount of the award for Trump’s attorneys’ fees would be determined later.

Daniels' attorney, Michael Avenatti, vowed to appeal and said he's confident the ruling will be reversed.

Daniels' lawsuit over a hush-money deal is pending.

In April, Daniels appeared on ABC's The View and unveiled the sketch of a man who she says accosted her in a Las Vegas parking lot in 2011.

Daniels, who has also sued over a $130,000 hush money agreement over the alleged encounter, sued over the tweet, claiming it made her appear to be a liar

Daniels said the man approached her as she was getting her infant daughter out of the car to attend a mommy-and-me exercise class.

'I noticed him because he was sort of well-dressed and nothing about him alarmed me,' she said in her first live television interview after the hush money payment given to Daniels by President Trump's lawyer Michael Cohen was unveiled.

'I really thought he was somebody's husband not wanting to be in whatever his wife was doing.'

When she noticed his reflection in her car's window she expected him to ask for directions.

Instead the man threatened the adult film actress and her daughter, telling her to 'forget about this story, leave Mr. Trump alone.'

Upon unveiling the sketch, Stormy's lawyer, Avenatti, said they would pay a $100,000 reward for the identity of the man, and asked for tips to be sent to IDTheThug@gmail.com.

In April, Daniels appeared on ABC's The View and unveiled the sketch of a man who she says accosted her in a Las Vegas parking lot in 2011

Daniels said the man approached her as she was getting her infant daughter out of the car to attend a mommy-and-me exercise class

'We want to get to the bottom of who this is, and we think we know who this is, but we want to confirm it,' Avenatti told The View's audience.

Avenatti divulged more details about the mystery man during a Tuesday afternoon appearance with CNN's Jake Tapper.

The lawyer explained that Daniels had looked at photos of a number of individuals 'we believe indirectly' worked for Trump and Cohen, Avenatti said.

'She has reviewed, Jake, a number of photographs over the last few weeks, couple weeks, actually and we've narrowed it down,' the lawyer said.

He didn't mention whether the drawing was made before or after Daniels saw the photos.

Tapper asked why Avenatti and Daniels wanted the public's help if they already narrowed it down.

'What we're hoping for is someone saw something or heard something. Ideally one of these individuals would have bragged about it to a member of the public,' Avenatti said.

Daniels told 60 Minutes that she did not report the encounter to police at the time because she was scared.

She also pointed out that if she had gone to the police a public record would have been produced and she likely would have had to explain that she had a previous alleged sexual encounter with Trump, which is why the threat took place.