Sir Paul McCartney had the words of William Shakespeare "subconsciously planted" in his mind when he wrote 'Let It Be'.

Sir Paul McCartney

Sir Paul McCartney

The 79-year-old star studied Shakespeare's 'Hamlet' at school and he admits that it inspired him to write the chart-topping single, which was released in March 1970.

He shared: "One interesting thing about 'Let It Be' that I was reminded of only recently is that, while I was studying English literature at the Liverpool Institute High School for Boys with my favourite teacher, Alan Durband, I read 'Hamlet'.

"In those days you had to learn speeches by heart because you had to be able to carry them into the exam and quote them. There are a couple of lines from late in the play:

"O, I could tell you —

"But let it be. Horatio, I am dead."

John admits the band were "heading towards the break-up of the Beatles" at the time he wrote the song.

The music icon explained that the presence of Yoko Ono, John Lennon's widow, made things challenging for the group - but Shakespeare helped to inspire one of the group's most memorable singles.

In his new book, 'The Lyrics: 1956 to the Present' - extracts of which have been published in the Sunday Times newspaper - Paul explained: "I suspect those lines had subconsciously planted themselves in my memory.

"When I was writing 'Let It Be', I’d been doing too much of everything, was run ragged, and this was all taking its toll. The band, me - we were all going through times of trouble, as the song goes, and there didn’t seem to be any way out of the mess.

"I fell asleep exhausted one day and had a dream in which my mum, Mary, (who had died just over ten years previously) did, in fact, come to me. When you dream about seeing someone you’ve lost, even though it’s sometimes for just a few seconds, it really does feel like they’re right there with you, and it’s as if they’ve always been there. I think anyone who’s lost someone close to them understands that, especially in the period of time just after they’ve passed away. Still to this day I have dreams about John and George and talk to them.

"But in this dream, seeing my mum’s beautiful, kind face and being with her in a peaceful place was very comforting. She seemed to realise I was worried about what was going on in my life and what would happen, and she said to me, 'Everything will be all right. Let it be.'"