Generally considered one of the finest of Walter Scott’s novels, "The Heart of Mid-Lothian" was published in four volumes in 1818.
The novel deals with the social and political difficulties in Scotland of the years after 1736. The 1707 Act of Union, decreeing a common parliamentary government for England and Scotland, was unpopular in the north. Furthermore, the exiled Stuart line, driven from the throne in 1688, continued to agitate for reinstatement. Rebellion broke out on several occasions, notably in 1715 and 1745, when formidable armies mustered, one even invading England.
The Old Tolbooth prison in Edinburgh is called “the heart of Mid-Lothian,” and there Effie Deans is held on charges of having murdered her illegitimate son. Her sister, Jeanie Deans, makes a dangerous journey through outlaw-infested regions to London to seek the queen’s pardon for Effie. Justice and Scottish Presbyterianism are discussed at length, and issues of conscience provide the novel’s themes. Somewhat unusually for a Scott novel, the heroine, Jeanie, is not beautiful, wealthy, or of the upper class. Scott based the plot of "The Heart of Mid-Lothian" on an actual legal case, and the 1736 Porteous Riots (when a mob stormed the Edinburgh Tolbooth to seize Captain John Porteous, commander of the Guard, sentenced to death for firing on a gathering) provide the background for the novel’s opening chapters.