IN MIDDLE LIFE, the contented lord of a vast hereditary estate, master of the realistic novel, and former war hero became a tormented ascetic, would-be commoner, and apostle of nonviolence. Tolstoy's transformation caused Gorky to liken him and God to "two bears in one den," and prompted his biographers to look for a turning point. Henri Troyat speculated somewhat weakly that a recurring dream of death which first troubled Tolstoy in 1869 at the age of 41 refocused his life. Stefan Zweig wrote that Tolstoy "suddenly received a blow -- a blow from somewhere out in the dark," and that what he suffered "has no name and really no visible cause." Now, after unearthing a wealth of long-neglected or unavailable materials, including letters, legal records, village newspapers and previously sealed czarist files, Walter Kerr, a former New York Times foreign correspondent, has written The Shabunin Affair , a slim volume which brilliantly details the incident that undoubtedly changed Tolstoy and which itself reads with the power of a Russian novel.

In 1866, two mounted soldiers from a nearby slave- labor regiment approached Tolstoy on his land about an upcoming court-martial. An enlisted man had struck an officer, potentially a capital offense. Would Tolstoy defend him?

Briefly a law student, the writer never had received his degree nor appeared in court. Only once, seven years before, had he spoken in public. Moreover, an obligation weighed on him to keep churning out chapters of War and Peace (then called "1805") forThe Russian Herald , where they appeared in tandem with installments of Crime and Punishment -- perhaps the greatest feat in magazine publishing. Nonetheless, Tolstoy, whose ego and appetite for experience were large, decided to take the case. He viewed capital punishment with distaste, having witnessed the Parisian guillotine at work 12 years earlier.

Tolstoy found his client, Vasili Shabunin, confined to a humble isba (peasant hut). Constantly harassed by his Polish captain, Shabunin, the regimental scribe, habitually drank up to two shtofs (more than half a gallon) of vodka a day, but nonetheless managed to do his job. One day, without cause, the officer crumpled the scribe's work and ordered him beaten with rods. Shabunin then bloodied the captain's nose, and when he had sobered up, confessed. Though reputed to be an imbecile, Shabunin read and wrote well (rare in the army of the czar) and had memorized the Psalms. Polite to Tolstoy, he nonetheless refused to participate in his defense, evidently preferring a quick death to running the regimental gauntlet at bayonet point or being branded and chained to a wheelbarrow in Siberia.

The court-martial, which rated a special prosecutor from Moscow, drew an expectant crowd. Peasants sympathized with the accused. The gentry sided against Tolstoy, already regarded as a class traitor for serving scrupulously as an arbiter of the peace during the emancipation of the serfs.

Long afterwards, the czarist bar, often a target of Tolstoy's scorn, chided him for pleading an advokatski ("routinely lawyer-like") case. But his argument, set forth in English here for the first time, "reflected," as Kerr puts it, "both conviction and originality of thought." Despite his inexperience, Tolstoy offered a deft analysis of the Code of Military Justice, argued solidly for reduced punishment based on Shabunin's alcohol-dimmed capacity to cope with provocation, and momentarily wept for his client. Even so, the court returned with a death sentence. One of three judges dissented, opening the way for an appeal. Tolstoy immediately sent a brief to his cousin Alexandra, an influential noblewoman in St. Petersburg, who rushed it to Dmitri Milyutin, the minister of war. A few days later Milyutin told her that Tolstoy's papers failed to include the accused's regiment number. As a result, the minister claimed that he could not gather sufficient information to present the plea to the czar, who alone had power to lift a death sentence. Shabunin was shot. Soldiers leveled the burial mound to prevent it from becoming a shrine.

Kerr's ingenious search, made with Soviet compliance, through secret pre- Revolution archives, shows that the case was rigged. Milyutin and other powerful officers already knew everything about the incident and hardly needed the regimental number (which they easily could have gotten) to push the plea into the palace. Moreover, Czar Alexander II, once the liberal emancipator, personally had ordered the capital court-martial as part of a sweeping reaction that followed an attempt on his life earlier in 1866 and that lasted 40 years.

Unaware of the high-level machinations behind the execution, Tolstoy forever blamed himself and what he called "his feeble, miserable plea" for Shabunin's death. It became a source of shame so searing that for years he avoided the mere mention of his client's name and once uncharacteristically refused to help a fellow writer looking into the matter. Only late in life could he admit that the tragedy "had much more influence on my life than all the seemingly more important events of life: the loss or recovery of wealth, successes or failures in literature, even the loss of people close to me."

Initially, at least, the effects were bizarre. On the day after the firing squad, the future vegetarian shot snipe, and then in a frenzy slashed rabbits to bits with a long whip. First cracks appeared in his marriage. Taking a separate bedroom, he apparently had an affair with his foreman's wife, a nihilist. Then he threw a dress ball for his own wife, inviting and dotinggon Shabunin's judges. Within a year, the one who had voted against death put on a raccoon coat in mid-summer and sank himself in a river.

Plunging back into War and Peace , Tolstoy forced his protagonist, Pierre Bezukhov, to watch a military firing squad similar to Shabunin's. "From the moment," wrote Tolstoy, "Pierre had witnessed those terrible murders committed by men who did not wish to commit them it was as if the mainspring of his life, on which everything depended and which made everything appear alive, had suddenly been wrenched out and everything had collapsed into a heap of meaningless rubbish . . . he felt that the universe had crumbled before his eyes."

After War and Peace, Tolstoy scrapped plans for novels in the same vein on Peter the Great and the Decembrist rising of 1825. His theme of historical "predeterminism" yielded to questions of individual responsibility in Anna Karenina and especially Resurrection , in which a skewed trial like Shabunin's obsessed Nekhludov, a nobleman like Tolstoy. Unlike Tolstoy however Nekhludov personally visited all the important officials in St. Petersburg, secured the help of an experienced barrister in perfecting the plea, got it through to the czar, and finally achieved a glorious mitigation of sentence.

As he became the conscience of Russia, Tolstoy's lavish fiction gave way to utilitarian but undeniably powerful writing in support of passive resistance and religion based on the sacredness of human life. He warred on the death penalty. When asked the difference between a killing by a policeman and one by a terrorist he said that it was the same as the difference "between cat s--- and dog s---." Dark images of execution also appeared in his withering attacks on the repressive state and the Orthodox church, whose catechism specifically absolved the hangman and the soldier. Because of its neatness and premeditation, Tolstoy regarded execution as "more repulsive and contrary to human nature" than war, which he understood as a function of "patriotic herd hypnosis."

The Church excommunicated him. The sovereign hounded him with police, banned his work, and deported or jailed those who assisted him. No one dared lock up Tolstoy, who during his last 20 years probably was the most admired man in Russia, if not the world. Kerr is not the first to wonder how the Revolution would have turned out had he lived to see it. His moral vision already had pulsed beyond the frontier to influence social movements and activists from Jane Addams to Gandhi, his correspondent, whose first community, located 20 miles from Johannesburg was called Tolstoy Farm. Finally, it wrecked his family. When he left home the week before his death in 1910, he dictated a final article, "Really Effective Means." "Understandably," writes Kerr, "it was against capital punishment."

Future Tolstoy biographers will have to deal with this story of the writer's "secret cross," which Walter Kerr has told with feeling and precision.