The young JRR Tolkien’s dark retelling of a Finnish epic poem, which features a young man sold into slavery who unknowingly seduces his sister before killing himself, is to be published later this month for the first time.

The Story of Kullervo was written in 1915, while Tolkien was studying at Oxford. Thought to be his first work of prose fantasy, it sees the young writer who would go on to pen The Lord of the Rings retell part of the 19th-century Finnish poem the Kalevala. The author himself described it as “the germ of my attempt to write legends of my own”. The unfinished manuscript, which lies in the Bodleian Library in Oxford, has previously only appeared in an academic paper by the US Tolkien scholar Verlyn Flieger, with its release on 27 August by HarperCollins its first mainstream publication.

The work tells the story of the son of Kalervo, “Kullervo the hapless”, as Tolkien calls him. An orphan with supernatural powers, Kullervo is brought up in the home of a dark magician, Untamo, who killed his father, kidnapped his mother and tries to kill the boy three times. When Kullervo is sold into slavery, he swears revenge, but unknowingly commits incest with his twin sister – who kills herself when she discovers what they have done.

“And before he could leap up and grasp her she sped across the glade (for they abode in a wild dwelling …) like a shivering ray in the dawn light scarce seeming to touch the green dewy grass till she came to the triple fall and cast her over it down its silver column to the ugly depths,” writes Tolkien. “And her last wail he heard and stood heavy bent on the brink as a lump of rock till the sun rose and thereat the grass grew green and the birds sang and the flowers opened and midday passed and all things seemed happy: and Kullervo cursed them, for he loved her.”

Tolkien’s narrative breaks off shortly after this point, with the rest of the story, in which Kullervo then kills himself, told by the author in outline. In Stuart D Lee’s A Companion to JRR Tolkien, he compares the “straightforward prose” of Tolkien’s version of the tragic end of Kullervo with the “much more dramatic” end of Túrin in The Silmarillion. In Kullervo, Tolkien writes of the suicide of the young man: “The sword says if it had joy in the death of Untamo how much in death of even wickeder Kullervoinen. And it had slaid many an innocent person, even his mother, so it would not boggle over Kullervo. He kills himself and finds the death he sought for.”

In The Silmarillion, by contrast, Tolkien writes: “And from the blade rang a cold voice in answer: ‘Yea, I will drink thy blood gladly, that so I may forget the blood of Beleg my master, and the blood of Brandir slain unjustly. I will slay thee swiftly.’ Then Túrin set the hilts upon the ground, and cast himself upon the point of Guthrang, and the black blade took his life.”

HarperCollins called Kullervo “perhaps the darkest and most tragic of all JRR Tolkien’s characters”, adding that he was “the clear ancestor of Túrin Turambar, tragic incestuous hero of The Silmarillion”.

“In addition to it being a powerful story in its own right, The Story of Kullervo – published here for the first time with the author’s drafts, notes and lecture-essays on its source-work, The Kalevala – is a foundation stone in the structure of Tolkien’s invented world,” said the publisher.

“I was immensely attracted by something in the air of the Kalevala,” Tolkien wrote in 1955 to WH Auden. “I never learned Finnish well enough to do more than plod through a bit of the original, like a schoolboy with Ovid … But the beginning of the legendarium … was in an attempt to reorganise some of the Kalevala, especially the tale of Kullervo the hapless, into a form of my own.”

In 1914, he wrote of how he was “trying to turn one of the stories – which is really a great story and most tragic – into a short story … with chunks of poetry in between”.

John Garth, in his Tolkien and the Great War, calls the tale “a strange story to have captured the imagination of a fervent Roman Catholic: Kullervo unwittingly seduces his sister, who kills herself, and then he too commits suicide”.

But Garth suggests that “the appeal perhaps lay partly in the brew of maverick heroism, young romance, and despair”.

“The deaths of Kullervo’s parents may have struck a chord, too,” adds Garth, alluding to the deaths of both of Tolkien’s parents by the time he was 12. “An overriding attraction, though, was the sounds of the Finnish names, the remote primitivism, and the Northern air.”

The Story of Kullervo is the latest in a handful of previously unpublished works from Tolkien that have been released in recent years, including his translation of Beowulf, his poem The Fall of Arthur, and the unfinished Middle-earth story The Children of Húrin.