Exactly a century after rumours of his death turned out to be entirely accurate, one of Mark Twain's dying wishes is at last coming true: an extensive, outspoken and revelatory autobiography which he devoted the last decade of his life to writing is finally going to be published.

The creator of Tom Sawyer, Huckleberry Finn and some of the most frequently misquoted catchphrases in the English language left behind 5,000 unedited pages of memoirs when he died in 1910, together with handwritten notes saying that he did not want them to hit bookshops for at least a century.

That milestone has now been reached, and in November the University of California, Berkeley, where the manuscript is in a vault, will release the first volume of Mark Twain's autobiography. The eventual trilogy will run to half a million words, and shed new light on the quintessentially American novelist.

Scholars are divided as to why Twain wanted the first-hand account of his life kept under wraps for so long. Some believe it was because he wanted to talk freely about issues such as religion and politics. Others argue that the time lag prevented him from having to worry about offending friends.

One thing's for sure: by delaying publication, the author, who was fond of his celebrity status, has ensured that he'll be gossiped about during the 21st century. A section of the memoir will detail his little-known but scandalous relationship with Isabel Van Kleek Lyon, who became his secretary after the death of his wife Olivia in 1904. Twain was so close to Lyon that she once bought him an electric vibrating sex toy. But she was abruptly sacked in 1909, after the author claimed she had "hypnotised" him into giving her power of attorney over his estate.

Their ill-fated relationship will be recounted in full in a 400-page addendum, which Twain wrote during the last year of his life. It provides a remarkable account of how the dying novelist's final months were overshadowed by personal upheavals.

"Most people think Mark Twain was a sort of genteel Victorian. Well, in this document he calls her a slut and says she tried to seduce him. It's completely at odds with the impression most people have of him," says the historian Laura Trombley, who this year published a book about Lyon called Mark Twain's Other Woman.

"There is a perception that Twain spent his final years basking in the adoration of fans. The autobiography will perhaps show that it wasn't such a happy time. He spent six months of the last year of his life writing a manuscript full of vitriol, saying things that he'd never said about anyone in print before. It really is 400 pages of bile."

Twain, who was born Samuel Langhorne Clemens, had made several attempts to start work on autobiography, beginning in 1870, but only really hit his stride with the work in 1906, when he appointed a stenographer to transcribe his dictated reminiscences.

Another potential motivation for leaving the book to be posthumously published concerns Twain's legacy as a Great American. Michael Shelden, who this year published Man in White, an account of Twain's final years, says that some of his privately held views could have hurt his public image.

"He had doubts about God, and in the autobiography, he questions the imperial mission of the US in Cuba, Puerto Rico and the Philippines. He's also critical of [Theodore] Roosevelt, and takes the view that patriotism was the last refuge of the scoundrel. Twain also disliked sending Christian missionaries to Africa. He said they had enough business to be getting on with at home: with lynching going on in the South, he thought they should try to convert the heathens down there."

In other sections of the autobiography, Twain makes cruel observations about his supposed friends, acquaintances and one of his landladies.

Parts of the book have already seen the light of day in other publications. Small excerpts were run by US magazines before Twain's death (since he needed the money). His estate has allowed parts of it to be adapted for publication in three previous books described as "autobiographies".

However, Robert Hirst, who is leading the team at Berkeley editing the complete text, says that more than half of it has still never appeared in print. Only academics, biographers, and members of the public prepared to travel to the university's Bancroft research library have previously been able to read it in full. "When people ask me 'did Mark Twain really mean it to take 100 years for this to come out', I say 'he was certainly a man who knew how to make people want to buy a book'," Dr Hirst said.

November's publication is authorised by his estate, which in the absence of surviving descendants (a daughter, Clara, died in 1962, and a granddaughter Nina committed suicide in 1966) funds museums and libraries that preserve his legacy.