The marriage was not particularly happy for Sophia. She'd grown up in a cosmopolitan, aristocratic world, and after marrying Tolstoy, she had to live on a rural estate where her husband lived almost like a peasant. His house was extraordinarily simple, with no upholstered furniture and no carpets on the floor. He even wore peasant clothes, when he wasn't entertaining guests.
But for Tolstoy, the early years of his marriage were some of the happiest of his life. The regularity of married life let him settle down to work more steadily than ever before. And in the midst of that happiness, he wrote his first masterpiece, War and Peace (1863). It was the longest and most ambitious novel he'd ever written, and he was only willing to attempt it because he now had his wife to work as his secretary. When he would scribble corrections all over a rough draft, she was the only person who could decipher what his corrections said. Even he couldn't read his own handwriting. She ultimately copied by hand the 1400-page manuscript for War and Peace (1863) four times.
While he was working on War and Peace, free love was becoming fashionable among the Russian upper classes, and everyone started to think of marriage as old-fashioned and silly. Tolstoy was disgusted. In 1872, he heard about a woman who had thrown herself in front of a train after the end of an affair, and he went to view the body at the train station. He never forgot what he saw that day, and it gave him an idea for a novel about a woman whose life is destroyed by adultery.
That novel was Anna Karenina (1877), in which the story of the romance between Konstantin Levin and a young woman named Kitty was based almost entirely on Tolstoy's own marriage. When it was published, most critics said Anna Karenina was inferior to War and Peace, but it is now considered one of the greatest novels ever written. It begins, "All happy families are alike; each unhappy family is unhappy in its own way."