Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

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.

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.

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

U.S. District Judge James Otero in Los Angeles dismissed the lawsuit because Trump and Cohen have agreed not to enforce the nondisclosure agreement against Daniels, court documents showed.

"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.

The nondisclosure agreement did not prevent Daniels from speaking to news media, including CBS' "60 Minutes," or releasing a memoir, "Full Disclosure." (Reporting by Brendan O'Brien in Milwaukee; Editing by Scott Malone, Peter Cooney and Richard Chang)