The novel and the July Revolution
Stendhal had the book at the press in the summer of 1830, when the July Revolution overthrew King Charles X, and it reached the bookshops at the end of that year. The opening itself records the shock: the Advertisement says the work was about to be published when the great events of July diverted the public's taste, and pretends the pages were written in 1827. The subtitle, chronicle of 1830, warns that the subject is the France of that moment. That is why the novel stops in the middle of the conspiracy to discuss politics: the imaginary editor argues that, without it, the characters would cease to be Frenchmen of 1830 (chapter 22 of Book II).
France after Napoleon
Napoleon abdicated in 1814, returned to power for the Hundred Days, and was finally defeated at Waterloo in 1815; he died a prisoner on the island of Saint Helena in 1821. The Bourbons returned to the throne, with Louis XVIII and, from 1824, with Charles X, and this period, from 1814 to 1830, is the Restoration. For a poor and capable young man, the country had changed its rules: under the Empire, a military career could make a commoner a general, and now the best posts depended on birth, money and protection. This is the calculation Julien Sorel makes when he trades the dream of a uniform for the cassock, after reading the bulletins of the Grand Army and the Memorial of Saint Helena, the account of Napoleon's exile (chapter 5 of Book I). The mayors, like Rênal, were appointed, not elected, and intrigues for posts, like the one over the deputy mayor's post, move the whole town (chapter 17 of Book I). In Paris, the tomb of Marshal Ney, executed by firing squad in 1815, has no epitaph, because a prudent policy denies him that honor (chapter 2 of Book II).
The Church at the center of power
Under the Restoration, the Catholic Church again weighed on politics, and the novel shows it from within. The Congregation, an association of laymen and priests founded in 1801, gathered the traditionalists and favored the careers of its members; in 1830, the opposition press spoke of a shadow government of Jesuits and fanatics. It appears already in the scene where the justice of the peace of Verrières starts judging to please a young vicar thought to be a spy for the Congregation (chapter 5 of Book I), and it takes shape in the vicar general Frilair, who rules Besançon (chapter 29 of Book I). Within the clergy there is another division: Chélan and Pirard are Jansenists, followers of a rigorist current, condemned by the Church, which opposed the lax morality it attributed to the Jesuits, and for that reason they are treated as suspects (chapter 18 of Book I). In Book II, Stendhal invents a secret meeting of nobles and prelates in which a cardinal argues for giving everything to the clergy, and the scene gives body to the fear of a parallel government of which the opposition spoke (chapter 23 of Book II).
The crime that gave the plot
The plot has a real source. Antoine Berthet, a former seminarian, shot his former lover, Madame Michoud, inside the village church, during Mass, on July 22, 1827. She survived. Berthet was tried in December 1827, sentenced to death and guillotined in Grenoble, Stendhal's hometown, on February 23, 1828. The case was reported in the Gazette des Tribunaux, a newspaper Stendhal read and which the novel itself cites (chapter 22 of Book II). The shot in the church in Verrières (chapter 35 of Book II) and the trial (chapter 41 of Book II) follow this case closely. The novel adds what the trial record did not have: Julien's ambition, the Paris salons and the speech to the jury.
How it was received
At the time, the book found few readers, and Stendhal himself claimed to be writing for readers of a distant future. Only in the decades after his death, in 1842, did the novel come to occupy the place of the great French novel of the nineteenth century.