In 1831 Pushkin married Natalya Nikolayevna Goncharova and settled in St. Petersburg. Once more he took up government service and was commissioned to write a history of Peter the Great.
Three years later he received the rank of Kammerjunker (gentleman of the emperor's bedchamber), partly because the tsar wished Natalya to have the entree to court functions. The social life at court, which he was now obliged to lead and which his wife enjoyed, was ill-suited to creative work, but he stubbornly continued to write. Without abandoning poetry altogether, he turned increasingly to prose.
Alongside the theme of Peter the Great, the motif of a popular peasant rising acquired growing importance in his work, as is shown by the unfinished satirical Istoriya sela Goryukhina (1837; The History of the Village of Goryukhino), the unfinished novel Dubrovsky (1841), Stseny iz rytsarskikh vremen (1837; Scenes from the Age of Chivalry), and finally, the most important of his prose works, the historical novel of the Pugachov Rebellion, Kapitanskaya dochka (1836; The Captain's Daughter), which had been preceded by a historical studyof the rebellion, Istoriya Pugachova (1834; "A History of Pugachov").
Meanwhile, both in his domestic affairs and in his official duties, his life was becoming more intolerable. In court circles he was regarded with mounting suspicion and resentment, and his repeated petitions to be allowed to resign his post, retire to the country, and devote himself entirely to literature were all rejected. Finally, in 1837, Pushkin was mortally wounded defending his wife's honour in a duel forced on him by influential enemies.