JK Rowling says that making “such a mess of my life” spurred her on to write her first Harry Potter novel.
The bestselling author, 55, was “insecure” and lacked self-belief when she put the story of the boy wizard to paper.
She tells Tracks Of My Years, for BBC Radio 2’s Ken Bruce show, what made her keep going.
“You have to push through your lack of belief,” the multi-millionaire author said.
“Certainly with Potter and with other things I’ve written, I’ve put them down for months at a time.
“I have got better at believing that I can push through.
“I remember when I was writing Potter I was writing two other things simultaneously and slowly but surely I realised that Potter was the best of them.
“And even though I was very insecure I just kept pushing on.”
Rowling wrote the first Potter book while a struggling single mother in Edinburgh, having split from first husband Jorge Arantes.
She had the idea for Harry Potter while on a delayed train to London King’s Cross in 1990 and over the next five years began to plan out the books in the series.
“The thing that pushed me to complete the book and really to have belief, was having made such a mess of my life generally,” the author said.
“I do remember feeling, ‘Look, so you get turned down by every publisher in the country, what’s to lose now?’”
She “certainly didn’t” think that the novel would be a “massive success” and its synopsis was rejected multiple times before being accepted.
“What I did believe was, I came to a point where I thought, ‘This is a good story and I’m going to put everything into this and see what happens,’” Rowling said.
“And I’d lost the fear of failing or rejecting that had probably hampered me a little bit early on in my writing.”
She added: “I had the idea for Harry Potter when I was 25 and I’d done a lot of writing before then, but I was extraordinarily insecure and very rarely shared anything that I’d written.
“I wrote some spoof things for friends to make them laugh, but I never shared anything that I’d written in earnest because I was quite insecure.”
When she was finishing the first Potter book in cafes “I still had this degree of belief in the story that quelled my doubts and made me keep working, difficult though it was at that time,” she said.
The author, who has sparked strong criticism for recent comments on gender identity, said she wanted to “get unvarnished criticism” when she penned her Cormoran Strike crime books under the pseudonym Robert Galbraith.
“It was a fantastic experience. I can honestly say the rejection letters were fantastic,” she added.
“I know that sounds bizarre and masochistic, but it was satisfying because I was getting unvarnished feedback and I was resilient enough to think, ‘Well that is a fair comment, but.. I don’t agree with that comment’.
“You’ve got to have faith in what you’re doing but I’ve never been arrogant enough not to believe that I need feedback and a good editor is essential, however successful you are.”
She added: “The first three months I had, when no one knew it was me and I was Robert Galbraith, and Robert started to get letters… and fan feedback… was so genuine and so lovely.”
JK Rowling chooses her Tracks Of My Years for BBC Radio 2’s Ken Bruce show (9.30am-12pm) on Monday to Friday.
By Sherna Noah, PA Senior Entertainment Correspondent