President Donald Trump denies the allegations made by Stormy Daniels
A US judge has dismissed adult film star Stormy Daniels' defamation lawsuit against President Donald Trump.
Stormy Daniels, whose real name is Stephanie Clifford, says she had a sexual relationship Mr Trump in 2006.
She filed the case after the president tweeted that she had invented a story about being threatened for speaking out about the alleged affair.
But the judge ruled that the tweet was protected by the First Amendment, which guarantees freedom of speech.
Stormy Daniels was also ordered to pay Mr Trump's legal fees, although the amount is yet to be determined. Her lawyer said she would appeal against the decision.
Mr Trump has denied any relationship with the actress.
In an interview with CBS News earlier this year, Stormy Daniels said a stranger approached her while she was with her young daughter and threatened her.
She later issued an image of the man.
Mr Trump responded to her account on Twitter, saying: "A sketch years later about a nonexistent man. A total con job, playing the Fake News Media for Fools (but they know it)!"