Image copyright Getty Images Image caption President Donald Trump denies the allegations made by Stormy Daniels

A US judge has ordered porn actress Stormy Daniels to reimburse President Donald Trump's legal fees after her defamation case was thrown out.

Ms Daniels, who says she had sex with Mr Trump in 2006, sued him after he mocked her claim that a stranger had threatened her to keep quiet.

On Tuesday, a judge ordered her to pay over $293,052.33 (£234,000) - roughly 75% of Mr Trump's legal fees.

A lawyer for Mr Trump celebrated the ruling as a "total victory".

In Tuesday's ruling, Los Angeles Judge James Otero declined to impose the "significant additional sanctions" requested by the US president's legal team against Ms Daniels.

Mr Trump's attorney, Charles Harder, had earlier requested that Ms Daniels be forced to pay almost $800,000 after her lawsuit was dismissed in October.

He said on Tuesday that the penalty includes $1,000 for having filed a "meritless" case.

"The court's order," Mr Harder said, "along with the court's prior order dismissing Stormy Daniels' defamation case against the President, together constitute a total victory for the President, and a total defeat for Stormy Daniels in this case."

Ms Daniels' lawyer, Michael Avenatti, said in a tweet that the ruling "will never hold up on appeal".

Image copyright Getty Images

Mr Avenatti is representing Ms Daniels in another lawsuit against Mr Trump and his former attorney Michael Cohen.

The adult film actress is seeking to void a nondisclosure agreement about her alleged affair with the president.

What was the defamation case about?

Ms Daniels, real name Stephanie Clifford, said last April that she had been threatened by a man in a car park to keep quiet about the alleged affair.

She shared a sketch of the man who she claimed had threatened her and her child.

Mr Trump retweeted the image, calling it a "total con job", and describing the image as being of a "non-existent man".

She sued arguing that the president's tweet was defamatory as it accused Ms Daniels of "committing a serious crime" - namely, falsely accusing a person of threatening her.

But in October, the judge ruled that Mr Trump's tweet was protected under the First Amendment, which guarantees the right to freedom of speech.

The judge said Mr Trump's tweet was merely a "hyperbolic statement" against a political antagonist.

After that initial court victory, Mr Trump promptly took to Twitter, saying his legal team could now "go after Horseface and her 3rd rate lawyer".

Who else is involved?

Mr Trump's former personal attorney, Mr Cohen, will be sentenced in New York on Wednesday for paying Ms Daniels $130,000 to keep the alleged liaison private.

According to prosecutors, Mr Cohen was directed to make the payment to Ms Daniels - and to another woman - by Mr Trump.

Mr Trump has acknowledged the payment was made, describing it only this week as "a simple private transaction", though he denies having a sexual relationship with her.

Mr Cohen has admitted the payment, which was not reported to election officials, was a violation of campaign finance laws.

Memo reveals Cohen's help on Russia probe