Kesha and Dr. Luke agreed to settle their nearly decade-long legal battle, averting a trial that was set to begin this summer.

The pop star filed a lawsuit against the producer in 2014, alleging he drugged and raped her nine years earlier, and psychologically tormented her throughout their working relationship. She claimed he harassed her about her weight, denigrated her voice and lorded his power over her career.

Dr. Luke responded to the claims with his own defamation lawsuit, claiming she made "completely untrue and deeply hurtful" claims to tarnish him and get out of her record contract.

In an Instagram post shared Thursday by both the recording artist and the producer, they wrote, "Kesha and Dr. Luke have agreed to a resolution of the lawsuit, and have agreed to issue and post a joint statement regarding that resolution. In resolution of that lawsuit, Kesha and Dr. Luke each state the following."

KESHA REVEALS NEAR FATAL HEALTH SCARE SPARKED BY FREEZING HER EGGS: ‘IT WAS HORRIFYING’

Pop star Kesha and producer Dr. Luke

Kesha and Dr. Luke settled their long-standing legal feud, and shared statements on Instagram. (Getty Images)

APP USERS CLICK HERE TO VIEW INSTAGRAM POST

"Only God knows what happened that night," Kesha wrote. "As I have always said, I cannot recount everything that happened. I am looking forward to closing the door on this chapter of my life and beginning a new one."

She added, "I wish nothing but peace to all parties involved."

Dr. Luke's statement said, "While I appreciate Kesha again acknowledging that she cannot recount what happened that night in 2005, I am absolutely certain that nothing happened. I never drugged or assaulted her and would never do that to anyone."

He added, "For the sake of my family, I have vigorously fought to clear my name for nearly 10 years. It is time for me to put this difficult matter behind me and move on with my life. I wish Kesha well."

Kesha walks red carpet wearing black dress

Kesha sued Dr. Luke in 2014 alleging he drugged and raped her in 2005. (Axelle/Bauer-Griffin/FilmMagic)

Dr. Luke, whose full name is Lukasz Gottwald, has produced hits for a wide-range of artists, including Britney Spears, Katy Perry, Kelly Clarkson, Paris Hilton, Flo Rida and Avril Lavigne.

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

"Today—after almost 10 years of litigation on Luke’s defamation claims—Kesha Sebert and Luke Gottwald posted a joint public statement on their Instagram accounts, resolving the case and wishing each other the best moving forward," his lawyer said in a statement provided to Fox News Digital. 

"As Luke says in the joint statement approved by Kesha, he fought this difficult fight to clear his name and for his family. He has been consistent from day one that Kesha’s accusations against him were completely false."

Kesha's representatives did not immediately respond to Fox News Digital's request for comment. 

Kesha walks red carpet at Billboard music awards

During sworn questioning in 2017, Kesha said "the abuse I suffered from Luke was a decade long, every day, every moment of every day." (Jeff Kravitz)

During sworn questioning in 2017, the "TikTok" singer said "the abuse I suffered from Luke was a decade long, every day, every moment of every day."

She also claimed the ordeal sparked a flare-up of an eating disorder, and she sought treatment in rehab for two months in 2014.

CLICK HERE TO GET THE FOX NEWS APP

Dr. Luke’s career also took a hit after she went public with her allegations. He has said various artists, particularly female ones, eschewed "working with someone who’s called a rapist."

But under the name Tyson Trax, he made it back to the top of the charts in 2020 with Doja Cat’s "Say So," garnering his first Grammy nomination since 2014. By this year, he was ASCAP’s pop songwriter of the year once again.

Earlier in the case, Kesha was ordered to pay Dr. Luke more than $373,000 in interest on royalties she paid him years late.

The Associated Press contributed to this report.