Back when there was a dollar sign in her name, Kesha Sebert wasn’t exactly known for taking the high road. That’s not a dis; in her songs, Kesha had a flair for cutting men down to size with raucous humor, if not always an evident maturity. “Dinosaur,” a sassy track off her platinum-selling debut album, Animal, took shots at a “creepy” older man trying to bed her (“Not long ’til you’re a senior citizen / And you can strut around with a sexy tank of oxygen”); her follow-up EP, Cannibal, featured a track titled “Grow a Pear.” One of Kesha’s greatest kiss-off songs, though, is “Thinking of You,” a stomping, rockish breakup ode that soared toward an epic chorus and ended with her leaning into the mic and whispering, “teeny weenie.” That song was on 2012’s rollicking Warrior, the last record she’d release for five years. Now, she has returned with a soulful sound on new single “Praying,” and a forthcoming full-length Rainbow set for release August 11. “Praying” is a mournful, spirited statement of self: It’s not the first fuck-you Kesha has ever summoned on record, but it is the most stirring, the most mature, and by far the most powerful.

Kesha has not released music for five years because she’s been embroiled in an ongoing and uncomfortably public legal battle with her one-time producer Dr. Luke, who she sued in October 2014 for infliction of emotional distress, gender violence, and unfair business arrangements, in addition to an accusation of sexual assault. Kesha signed a contract with the influential producer when she was 18, and what followed was nearly a decade of what her lawyer has described as “mental manipulation [and] emotional abuse.” She has claimed that Luke drugged her, frequently made sexual advances toward her, and repeatedly criticized her weight, the latter of which contributed to her checking into rehab for treatment of an eating disorder after Warrior was released. Luke immediately countersued, claiming Kesha was in breach of contract, extorting him, and attempting a smear campaign. Allegations have been traded back and forth for years now. Kesha’s fans took to social media to start a #FreeKesha campaign. As time has gone on, Luke’s name has become tarnished in the upper echelons of pop, with artists like Kelly Clarkson and Adele voicing their support for Kesha. This April he was released from his contract with Sony, which helped pave the way for Kesha’s return, although it’s unclear if he and his former company, Kemosabe Records, which Sony distributes, will be profiting off a record that will likely tell Kesha’s side of the story.

Rainbow will find Kesha working with a new set of collaborators, among them Dolly Parton, Eagles of Death Metal, and Macklemore’s sidekick, Ryan Lewis, who cowrote “Praying.” It’s a remarkable return. The arrangement is sparse enough to put Kesha’s raw, goosebump-inducing vocals center stage, and for people who’ve only ever heard her drenched in Auto-Tune, the depth and grit of her voice will come as a surprise. The first half of “Praying” is stirring but lonely — a gospel choir of one. But it eventually builds toward something ecstatic, when, at the end of the second verse, Kesha growls with an almost possessed strength, “When I’m finished, they won’t even know your name.”

The accompanying video, directed by Jonas Akerlund, is a riot of color and surreal imagery. Kesha could have easily gone the low-concept “I’m a Serious Artist Now” route by setting the song to solemn, simple visuals — but what would be the fun in that? Kesha’s liberation is just as Technicolor as her past, and that’s one of the most affecting things about “Praying.” As the song’s momentum builds, she ascends a mountain covered in junk wearing gold lamé leggings and self-made wings, like a thrift-shop Lazarus. The video serves as a transition between her painful past and her triumphant present: There’s a part of her spirit, her style, her self that this experience didn’t take away.

“I hope you’re somewhere praying,” Kesha sings, the lyric landing somewhere between a blessing and a threat. She’s said the song “is about coming to feel empathy for someone else even if they hurt you or scare you. … It’s also about hoping everyone, even someone who hurt you, can heal.” What makes “Praying” so powerful is that she doesn’t seem fully healed herself. She’s allowing us to hear what her breath sounds like climbing up that mountain, not yet having reached the ease and safety of the peak. It’s an act of vulnerability that announces a new phase for Kesha, but led by that familiar spitfire heart that’s been at the core of her all along.