Kafka: The Years of Insight. By Reiner Stach. Princeton University Press; 682 pages; $35 and £24.95. Buy from Amazon.com, Amazon.co.uk

IN 1915 a short story called “The Metamorphosis” (“Die Verwandlung”) was published in a small German magazine. It told the story of Gregor Samsa, a salesman who wakes up one morning to find that he has turned into an enormous bug. The author, Franz Kafka, was a middle-ranking civil servant working in Prague. He would die less than ten years later, a little-known author of three novels and several shorter works. But “The Metamorphosis”—perhaps 50 pages long—would go on to inspire countless stage adaptations and doctoral theses and scores of subsequent writers. The story, along with the novels “The Trial” and “The Castle”, ensured Kafka’s place as one of the most important writers of the 20th century.

“Kafka: The Years of Insight” is the second volume of Reiner Stach’s masterful biography of the author. The first dealt with the years 1910 to 1915, when Kafka was a young man writing furiously into the night while working 50-hour weeks. The second volume records his burgeoning fame up until his death in an Austrian sanatorium at the age of 40, after years of suffering from tuberculosis. (A third volume, tracing his early years, is in the works.)

In these final years, from 1916 to 1924, Kafka receives letters from quizzical bank managers asking him to explain his stories (“Sir, You have made me unhappy. I bought your ‘Metamorphosis’ as a present for my cousin, but she doesn’t know what to make of the story”). He spends hours nagging away at his prose, only to rip it up, throw it away and start again. He apparently denies being the author of certain stories when asked by other invalids at a retreat. He has four love affairs, mostly through letters, and spends much of his time away from his cramped office at the Workers’ Accident Insurance Institute. These are years of insight, but also of depression and illness.

Despite the gloom, this biography makes for an excellent read. Mr Stach, a German academic, expertly presents Kafka’s struggles with his work and health against the wider background of the first world war, the birth of Czechoslovakia and the hyperinflation of the 1920s. Alert to the limits of biography, Mr Stach bases everything on archival materials and, where possible, Kafka’s own view of events. He is also wryly aware of the academic cottage industry that has sprung up around Kafka’s work, hints of which had already emerged in his lifetime. “You are so pure, new, independent...that one ought to treat you as if you were already dead and immortal,” wrote one fan.

The picture that emerges is of a difficult, brilliant man. In Mr Stach’s view, Kafka was “a neurotic, hypochondriac, fastidious individual who was complex and sensitive in every regard, who always circled around himself and who made a problem out of absolutely everything”. A decision to visit a married woman, soon to be his lover, takes him three weeks and 20 letters. When writing to his first fiancée, he refers to himself in the third person and struggles to evoke intimacy. Kafka makes decisions only to swiftly unmake them. Other people irritate him. “Sometimes it almost seems to me that life itself is what gets on my nerves,” he wrote to a friend.

But Mr Stach’s biography also shows Kafka’s lighter side. On holiday with a mistress, he feels almost sick with laughter. In the last years of his life he meets a crying young girl in a park who explains that she has lost her doll. He then proceeds to write her a letter a day for three weeks from the perspective of the doll, recounting its exploits. With his final mistress, Dora Diamant, Kafka has no doubt that he wants to marry her. She even inspires him to recover his interest in Judaism.

Such anecdotes pierce the austere image left by Kafka’s work. Mr Stach also effectively undermines conventional views of Kafka as a prophet of the atrocities to come (his three sisters died in Nazi concentration camps, as did two of his mistresses). A frequent target of anti-Semitic remarks, Kafka depicted the world as he saw it, full of lonely and persecuted individuals, but not one without hope.