The hidden theme behind C.S. Lewis' Narnia books has been uncovered in a BBC documentary screening this week on Sky's Documentary channel.

Each of the seven children's chronicles is based on one of the seven planets that comprised the heavens in medieval astrology, says a scholar whose theory is examined in the programme.

The explanation comes after more than five decades of literary and theological debate over whether Lewis devised the fantasies with a pattern in mind or created characters and events at random. It was put forward by Reverend Dr Michael Ward in his book Planet Narnia: The Seven Heavens in the Imagination of CS Lewis.

Norman Stone, director and producer of The Narnia Code, says the theory is the "best explanation yet" for the chimerical nature of the books.

The Chronicles of Narnia have sold more than 120 million copies in 41 languages since their first publication in the early 1950s. The first of the books, The Lion, The Witch and the Wardrobe, was turned into a film in 2005 and was followed by Prince Caspian, in 2008. A third film, Voyage of The Dawn Treader, is due for release in December.

The books are already known to work on two levels: the fantasy narrative enjoyed by generations of children, and the Christian allegory in which the lion Aslan represents Christ. However, Lewis never revealed the key behind the series.

Dr Ward made his discovery in 2003 after reading a poem by Lewis which refers to the influence of Jupiter in "winter passed / And guilt forgiv'n" - a theme echoed in The Lion, The Witch and The Wardrobe. Said Stone: "This isn't the first theory on Narnia and I don't suppose it will be the last, but this is the best explanation yet."

Stone won a Bafta and an Emmy for his 1984 epic Shadowlands, which traced the unusual relationship between Lewis and his wife, Joy Gresham.

The Narnia Code plays on the Documentary channel (Digital 74) on Wednesday at 8.30pm.