After a six-year-long legal battle, a judge ruled on Thursday that Kesha had defamed music producer Lukasz Gottwald in a text message sent to Lady Gaga.

In the text message, Kesha alleged that Gottwald, better known as Dr. Luke, had drugged and raped Katy Perry. This is just one piece of the defamation suit Gottwald brought against Kesha in 2014, where he alleged that Kesha claimed she was drugged and raped by him to get out of their recording contract.

New York Supreme Court Judge Jennifer Schecter ruled that the text message counts as defamation because Perry has denied Kesha’s claim.

“Perry unequivocally testified that Gottwald did not do so. In response, Kesha has not raised a triable issue. There is no evidence whatsoever that Gottwald raped Katy Perry or that Katy Perry, whose sworn testimony is unrefuted, must not be believed. Kesha cannot defeat summary judgment with mere speculation,” wrote Schecter in the ruling.

The judge denied Kesha’s claim that Gottwald was a “public figure” because his name had not been part of the public discourse until Kesha accused him of sexual assault. If the judge had ruled that Gottwald was a “public figure,” his lawyers would have to prove that Kesha acted with “actual malice,” which would have been a much harder case to make.

“Though Gottwald has sought publicity for his label, his music, and his artists — none of which are the subject of the defamation here — he never injected himself into the public debate about sexual assault or abuse of artists in the entertainment industry,” the judge wrote.

The judge also ordered Kesha to pay almost $374,000 in royalty payments from 2017.

In response, Kesha’s legal team said she would appeal.

“We disagree with the Court’s rulings. We plan to immediately appeal,” said Kesha’s lawyers in a statement to Variety.

“Dr. Luke looks forward to the trial of his case where he will prove that Kesha’s other false statements about him were equally false and defamatory,” Gottwald’s attorneys wrote in a statement to The Daily News.

Thursday’s ruling did not decide on whether Kesha was raped by Gottwald; that decision was still set to be decided by a jury.

The next court hearing was set for Feb. 21.