One of the most iconic children's books has a heartbreaking backstory.

The children’s book Love You Forever tells the moving story of the relationship between a boy and his mother.

Published in 1986, Robert Munsch writes that every night, even when the boy is badly behaved, his mother comes into his room, holds him in her arms, and sings him a lullaby. As he grows older and leaves home, she still comes into his room sometimes to sing the same words. When the mother grows frail and sick, her adult son sings a slightly different lullaby to her, promising to love her unconditionally after her death. The story ends with the son singing his mother’s lullaby to his baby daughter, implying that the cycle will go on for parents and children for generations to come.

But there’s a sad backstory to Munsch’s story, which surprisingly sold very well in retirement communities.

“Love You Forever started as a song,” Munsch writes on his website.

“I’ll love you forever,
I’ll like you for always,
as long as I’m living
my baby you’ll be.”

“I made that up after my wife and I had two babies born dead. The song was my song to my dead babies,” he writes.

“For a long time I had it in my head and I couldn’t even sing it because every time I tried to sing it I cried. It was very strange having a song in my head that I couldn’t sing.”

After their second stillbirth, Munsch and his wife were told they would never be able to have children naturally. The news was devastating. Munsch had a master’s degree in Child Studies, had worked with children, and spent his life writing children’s books.

Listen: What do you tell someone who’s lost a baby? Post continues after audio.

His lullaby was a way to process his grief.

Munsch said when he first performed this story to an audience – which he always did with his stories – they were visibly emotional. His wife “felt it too,” he told Huffington Post.

Initially, his publisher refused to publish the book, saying it was too ‘dark’ for children. But when he gave it to another publisher, “he said when he read it, he just felt the hair on the back of his neck stand up”.

Now 70, Munsch and his wife have three adopted children.

In 2008, he suffered a stroke, and says as he grows older, he now relates to the mother in Love You Forever.