Kesha: I sat around praying that one day my new song would come out

Kesha

Kesha says she wasn't sure that her new song would come out after years of legal battles with her former producer Dr Luke.

The US singer says she finished Praying a year ago, but didn't know if she'd legally be able to release it.

Talking to Nick Grimshaw on the Radio 1 Breakfast Show, she said: " I've been sitting around and praying that one day this would come out.

"There were times I didn't know if it was going to."

Dr Luke, who's also worked with Katy Perry, Miley Cyrus, Kelly Clarkson and Nicki Minaj, initially sued Kesha for breach of contract in 2014.

Kesha and Dr Luke
Image caption Kesha with Dr Luke in 2011

She countersued accusing him of sexually and emotionally abusing her, something he has always denied.

Kesha is still tied into a multi-album deal with Sony, and says this has been a hard record to write.

"I would get up. I would get in my car, and I would drive to the studio in my pyjamas, and I would lay in a hammock and cry and write a song.

"Then the poor producers I worked with would have to listen to me weep.

Warning: Third-party content, may contain ads

"But at the same time, I think if you listen to the record, I got a lot of that out of my system at the beginning. Once I'd got done weeping, then I got back to myself."

Kesha's third studio album Rainbow, the follow-up to 2012's Warrior, will be released on 11 August.

Kesha
Image caption Kesha performed at Radio 1's Big Weekend in Bangor in 2010

She says she hasn't had to please anyone else, other than herself, this time round.

"I went through a lot of stuff and I just wanted to start at ground zero and see what happened, not try to live up to anything, not try to be anybody, not try to please anybody else. So I've made a record I'm super-pleased with.

"It's my gift for my fans because they've been unbelievable over the past couple of years. I don't know what I would have done without them.

"They've been unwavering every single day. I get the most beautiful messages from all over the world and this record is dedicated to them.

"It's for my soul, dedicated to them."

Kesha
Image caption Kesha appeared on the Coachella Festival line-up last year with record producer Zedd

Earlier this week the 30-year-old singer wrote an essay documenting her struggles with depression, anxiety and an eating disorder.

"This song is about coming to feel empathy for someone else even if they hurt you or scare you," she wrote.

Kesha says she's really proud of her new music after the pain of the last few years.

"I feel like this music is the most proud I've ever been of anything I've ever done in my entire life, which is so exciting to say," she said.

"They [her tracks] were like my children, and I had so many of them. I had to pick and choose my favourites. I had the best kids on this record."

Find us on Instagram at BBCNewsbeat and follow us on Snapchat, search for bbc_newsbeat