(Reuters) - A federal judge in Los Angeles on Thursday dismissed a lawsuit brought by adult-film actress Stormy Daniels to end a hush-money agreement she had with U.S. President Donald Trump, court papers showed.

U.S. District Judge James Otero dismissed the lawsuit because Trump and his former lawyer Michael Cohen have agreed not to enforce the nondisclosure agreement against Daniels, court documents showed.

“The Court specifically found that Stormy received everything she asked for in the lawsuit - she won,” said Daniels’ attorney, Michael Avenatti, in a Twitter post.

Daniels, whose real name is Stephanie Clifford, filed a lawsuit in March 2018 to rescind a nondisclosure agreement that kept her from discussing her alleged 2006 sexual relationship with Trump in the final weeks before the 2016 U.S. presidential election.

Trump has denied having an affair with Daniels.

Cohen has said the agreement, under which Daniels was paid $130,000, was struck to help Trump capture the White House.

In his ruling, Otero sent the lawsuit back to California Superior Court, essentially ending the case. He said the case “lacks subject matter jurisdiction.”

The nondisclosure agreement did not prevent Daniels from speaking to news media, including CBS’ “60 Minutes,” or releasing a memoir, “Full Disclosure.”

“More than a year ago when I was being threatened with a 20 million lawsuit, I asked a judge to toss out this illegal NDA. Glad I stood my ground & kept fighting,” Daniels tweeted after the ruling was made public.

In October, Otero dismissed Daniels’s defamation lawsuit against Trump and ordered her to pay his attorney’s fees. He said in that ruling that a tweet the president had written referring to her was protected by free-speech laws.