The final hours of writer Robert Louis Stevenson have been revealed in a heartbreaking letter written by his grieving widow.

The letter, written by Fanny Stevenson and addressed to a friend, has been acquired by the National Library of Scotland, amongst other letters and manuscripts by the author.

She wrote it the day after her husband collapsed and died from what is believed to be a brain haemorrhage at their home in Samoa on December 3, 1894.

It reveals he was making mayonnaise with his wife before he died.

He was just 44 years old.

In her moving letter, Fanny wrote: "His life had been one long romance and he hoped to have a romantic end; the artist in him demanded that completeness.

"To grow old he could not bear. He has had his wish and, for that, I try to be thankful, though all the rest of my life will be empty and lonely.

"True, I have my children but I have not Louis. No one knows what that means but me."

She said she had been crushed by a sense of impending disaster in the days leading up to his death and he had tried to lighten her mood by playing cards.

Then they made mayonnaise for dinner.

She wrote: "I began to mix the mayonnaise; he dropping the oil with a steady hand, drop by drop. Suddenly, he set down the bottle, knelt by the table, leaning his head against it. I cannot go on just now.

"It was the hand of death that had stricken him down. In less than five minutes he was profoundly insensible and so remained till the end.

"It was about six when he knelt at the table and at ten minutes after eight, he passed away.

"In a very short time, we had two doctors and a medical missionary here but there was nothing to do."

The letter written by Fanny is one of a series she and her husband sent to Anne Jenkin, the wife of Stevenson's former Edinburgh University tutor and professor of engineering, Fleming Jenkin.

The letters, along with an incomplete manuscript of an essay, telegrams, photographs and newspaper cuttings, were bought by the library at auction.

They add to the library's large collection of Stevenson material, which includes papers about his early life in Edinburgh, his development as a writer and his time in Samoa.

The library has released details about the letters as the anniversary of Stevenson's death approaches.

They were bought with the support of the Soutar Trust and the Friends of the National Libraries.

National Librarian Dr John Scally said: "It is pleasing that these letters relating to one of Scotland's greatest ever writers are part of the collection in the city and the country of his birth.

"They are sure to be of interest to scholars and the wider public and we are delighted to have acquired them."

Fanny also speaks of the devotion of native Samoans to her husband, who they called Tusitala - meaning storyteller.

Stevenson's last wish was to be buried at the top of Mount Vaea which overlooked his home on Samoa.

It took 40 Samoans toiling for hours to cut a path through the bush to the burial place of chiefs.

There they dug a grave and placed a makeshift tinsel cross at its head.

Fanny wrote: "Nothing that money could buy would have pleased Louis more or more clearly touched his heart than that little tinsel cross."

Stevenson was plagued by ill health for most of his life and lived in many places to try to find a climate to ward off sickness.

He never expected to live a long life.

Fanny wrote: "I try to remember how he had hoped to go like this.

"That very day he had said to me 'the thought of dying in bed is horrible to me; I want to die like a clean human being on my feet. I want to die in my clothes, to fall just as I stand.'

"He did. It was only at the very end, for the last few breaths, that we laid him down."

Sally Harrower, curator of modern Scottish literary papers at the National Library, said: "It's always exciting to get Stevenson manuscripts, and this is the most susbtantial collection we've acquired for a while."