On Thursday JRR Tolkien's early story The Story of Kullervo will be published for the first time. The dark tale reveals that Tolkien's Middle Earth was inspired not only by England and Wales… but also by Finland.

"Hapless Kullervo," Tolkien called him. Kullervo, an orphan boy raised into slavery, a tragic hero who commits incest in the dark forests of Karelia and hurls himself on his own blade.

JRR Tolkien first discovered the tale as a schoolboy in Birmingham. His father had died when he was a young child, and his mother passed away when he was 12, so he had been an orphan himself for some years when he came across the Finnish epic Kalevala - and within it the tale of Kullervo - during his final year at school.

It had a huge impact.

"He was very much taken by the whole mythology," says Prof Verlyn Flieger of the University of Maryland, who edited the manuscript of The Story of Kullervo for publication. "In his letters he enthuses about this 'very great story'."

Arriving at Oxford University a year later, Tolkien began to write his own version of the Finnish myth. But after a few months he suddenly gave up.

"The manuscript runs to about 26 pages, but it breaks off in the middle of a sentence," Flieger explains. "He had just got to the climax, the most dramatic scene, and it stops. There is no full stop, no continuation of any kind. Only the words 'so terrible his haste'..."

Media playback is unsupported on your device Media caption Verlyn Flieger talks about working with JRR Tolkien's words

The unfinished manuscript was put aside. Meanwhile, Tolkien went on to invent his own Elvish languages, and to write his books about hobbits, elves and dragons, in time off from his day job as a professor of Anglo Saxon and Middle English.

Kullervo's tale is just one of 50 songs in the Kalevala, an epic of 22,795 verses telling the story of the Sampo, a magical object that bestows power on whoever possesses it. Tolkien used numerous plot elements from the Kalevala in his own novels - a powerful magical object, incest, battles between brothers, and orphan heroes setting out on quests.

"Kullervo is the origin story for Shakespeare's Hamlet - a young man whose uncle kills his father and on whom he wreaks a terrible vengeance," says Verlyn Flieger. "It is likely that Tolkien knew that Shakespeare had used this tale."

In The Silmarillion (begun in 1914, but only published after his death), Tolkien turns Kullervo into Turin Turambar, the warrior hero.

"I think he liked the Kalevala because it has both high and low elements," suggests Tolkien-biographer Prof John Garth from the University of Nevada. "There are clodhopping idiots, treated in a really down-to-earth, anti-heroic way. In Tolkien's own fiction, he creates totally different moods. The hobbits are very relatable, very friendly; and then the elves are much more remote."

The mists, forests and waterfalls of the Kalevala would have stood in stark contrast to the red-brick Edgbaston Waterworks that towered over Tolkien's Birmingham home.

Image copyright Thinkstock

"The landscape of Finnish mythology is very mysterious," says Verlyn Flieger. "It is a distant, northern country. Some of the stories even take place within the Arctic Circle. The country lends itself to a sense of magic and mystery."

Tolkien filled his own version of The Story of Kullervo with long descriptions of this foreign land.

Since the 12th Century Finland had been ruled by Sweden, and then Russia, only gaining independence in 1917. During the last century of foreign rule, the Kalevala - assembled by a physician who walked around Karelia writing down the poems people sang to him - became a powerful symbol of Finnish identity.

Image copyright ALAMY

"Tolkien liked the fact that this was a national myth," says John Garth. "He wished that England had something similar. Britain had Celtic stories but England had not preserved its mythology. With The Lord of the Rings he wanted to give England its own Kalevala."

Garth suggests that Finnish nationalism struck a chord with Tolkien. "You see that same ethos in the way he presents the Shire and the Hobbits: their freedom from interference, their 'funny little ways' that should be respected."

Image copyright AFP

Having fallen for the Finnish epic, the language-loving Tolkien was not content to read it only in translation. Once at Oxford, he found a book of Finnish grammar - and borrowed it "several times" laughs Verlyn Flieger. "Finnish is extremely difficult. I know this first-hand. I have tried to learn it myself!"

Although he never visited Finland and does not seem to have met any native speakers, Tolkien became captivated by the language. In 1955 he told the poet WH Auden that discovering Finnish had been like "entering a complete wine-cellar filled with bottles of an amazing wine of a kind and flavour never tasted before". But he had to admit that he had "never learned Finnish well enough to do more than plod through a bit of the original like a schoolboy…"

Dr Riitta-Liisa Valijarvi, senior teaching fellow in Finnish Language at University College London, says it doesn't deserve its reputation as one of the world's hardest languages.

"There are many grammatical cases. It is not an Indo-European language and so the vocabulary is not familiar. But the sound system is very easy, very basic, and that is what inspired [Tolkien's] Elvish," she says.

Valijarvi notices a particular trend among the students who choose to learn Finnish. "They tend to like heavy metal music and fantasy fiction," she laughs. Some of her students have even taught themselves Tolkien's fictional Elvish tongues. "I have not done this myself, but I do recognise the look and feel of the language," she says.

Tolkien was intrigued by the liked the long vowel sounds of Finnish and the umlaut accents. Fictional Elvish phrases such as "Mindon Eldalieva" ("Lofty Tower of the Elvish-people") and "Oron Oiolosse" ("Ever Snow-white Peak") use the sound and style of the language.

Tolkien's invented Elvish language of Quenya "is incredibly complex", explains John Garth. When writing The Hobbit in the 1930s and The Lord of the Rings (published in 1949), Tolkien included irregular verbs and archaic phrases, showing how his invented language had changed over time - the Quenya used by Aragorn differs from the older Quenya used by his ancient ancestors, in which the influence of Finnish is much stronger.

Image copyright ALAMY

For Tolkien the invented language came first, and Middle Earth second, according to Flieger. The much-loved adventures of Bilbo and Frodo were a chance for Tolkien the philologist to bring his new language to life.

"Tolkien realised with The Story of Kullervo that language, culture and mythology are inextricably linked," Flieger says. "He had invented a language - and so he invented a mythology."

But Finnish sources were not the only ones Tolkien used. Others include the romantic medieval images of Pre-Raphaelite paintings, the scenery of the Welsh countryside, the adventures of King Arthur, and his own traumatic experiences in the Battle of the Somme between July and November 1916.

Verlyn Flieger thinks the most Finnish aspect of Tolkien's writing is the mood.

"There is a strain of deep tragedy and pessimism that runs through Tolkien's work, even The Hobbit and certainly Lord of the Rings. The Story of Kullervo is without a doubt the darkest story he ever wrote. It is our first experience of that darkness."

The BBC Symphony Orchestra and Chorus perform Sibelius' Kullervo at the BBC Proms on Saturday 29 August.

The real places of Middle Earth

Tolkien wrote that The Shire - home to the "little people" better known as hobbits - was "more or less a Warwickshire village of about the period of [Queen Victoria's] Diamond Jubilee" in 1897.

Image copyright Marketing birmingham

Read more: The locations that inspired Tolkien

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.