American pop star Katy Perry is now riding high on success of her hit single "Roar" but there was a time when the 28-year-old star was so depressed that she even thought of ending her life by committing suicide.

The singer spoke candidly to Billboard magazine about her forthcoming album "Prism" and how she drew inspiration from the rough patch in her life when she split from ex-husband Russell Brand.

The singer revealed that she wrote a song "By The Grace God" at the time when she was amidst her divorce from Russell Brand and wondered if she deserves to live any further.

"That song is evident of how tough it really was at a certain point," she said.

"I asked myself, 'Do I want to endure? Should I continue living?'"

"I was still in a dark place," the 28-year-old star shared with Billboard magazine referring to the time when she started working on her upcoming album "Prism" back in November 2012.

"I hadn't let the light in," Perry revealed. All the songs on "Prism" are based on the real life experiences, the singer said.

The pop princess revealed how she kept lying on her bathroom floor wondering if she should commit suicide, when Brand filed for divorce in December 2011. The comedian reportedly informed Perry about this life altering decision of ending their marriage through a text message.

Katy Perry "Roar"

Source: Youtube.com/katyperryvevo

Perry instead chose life over death and found the songs as a means of her catharsis. The lyrics to her song "Ghost" have the incident mentioned, "You sent a text... It's like the wind changed your mind".

The "Roar" hit maker, who is now in a relationship with musician John Mayer, credits him for bringing her back to normal life after her rocky divorce.

"He is literally a genius, as is evident in his song writing," she said.

"I always tell him, 'Darling, you know I'm going to give your mind to science after you've passed, because we're going to have to understand how all these sparks work'."

"Prism" is scheduled to be released on October 18, 2013 by Capitol Records.