The Tolbooth, considered two centuries ago to be one of the largest and most sombre buildings in the kingdom, was built by the citizens of Edinburgh in 1561, originally for a Town Hall, but later devoted to the use of Parliament and the courts of justice. With the completion of the Parliament House in 1640, its original usage ceased, and from that time until its demolition in 1817, it was devoted exclusively to the imprisonment of debtors and criminals. No distinction was made between the lowest of the criminal classes and the poor persons whose only offence was the inability to pay some small debt. The latter were shut up for months in cells too loathsome for the most vicious of criminals. There were no areas for exercise nor any ways of affording the captives a breath of fresh air. The narrow windows were half-blocked to the light by massive bars of iron.

The exterior was not less horrible, for on its highest pinnacle were displayed the heads of prisoners of state who had been executed, and it was seldom lacking in such tokens. The Regent Morton, accused of the murder of Darnley; the Duke of Montrose, and later his great enemy, the Duke of Argyle, were among the most distinguished of these victims; but there were many others.

The Church of St. Giles almost touched elbows, so to speak, with the prison. The central portion was set apart for religious services under the name of the 'Old Church,' the worshippers of those days having a strong aversion to the use of the name of a saint. They seemed to have no objection to attaching to their sacred edifice the designation of the temporary abode of sinners, for the southwest quarter was called the 'Tolbooth Church,' from its proximity to the prison. On the morning of the 11th of April, 1736, according to the account of Robert Chambers, Wilson and Robertson were conducted to the Tolbooth Church, to listen to their last sermon, their execution having been planned for the following Wednesday. Very much as described in the novel, except that the incident took place almost instantly after they had seated themselves in the pew, instead of after the sermon as Scott says, Wilson seized three of the guards and shouted to Robertson to run. The latter tripped up the fourth soldier and quickly escaped, aided by the sympathetic church-goers, who contrived to block up the passages so that pursuit was impossible. Three days later, Wilson was executed in the Grassmarket. The sympathy of all Edinburgh was with him, for several reasons. First, his crime was only the robbery of a revenue officer, in reprisal for the seizure of his own goods on a charge of smuggling. In those days (and even now, it may be feared) the crime of cheating the Government out of its revenues was not considered an enormous one. If a poor smuggler happened to be caught, there was no reason why he should n't 'get even' with the officers if he had a good chance. At least, so Wilson argued, and many sympathized with his view. Second, the Scots were not yet entirely reconciled to the union, and the exhibition of too much authority at London was likely to be resented. Third, Wilson had acted the part of a generous friend and courageous man in sacrificing his own chances to secure the escape of Robertson.

Some stones were thrown at the captain of the City Guard, John Porteous, and that officer, beside himself with rage, snatched a gun from a soldier and, setting the example himself, commanded his party to fire. The result was the loss of six lives and the wounding of eleven persons, many of the victims being innocent spectators who were watching the affair from neighbouring windows. For this offence Porteous was tried and convicted, his execution being set for the 8th of September. Before the prisoner could be executed, a pardon reached Edinburgh, signed by Queen Caroline, acting as Regent. Robert Chambers says that it came on the 2d of September, giving the mob five days for preparation instead of a single afternoon, as described by Scott. It is a matter of history that the 'mob' acted with remarkable moderation, harming no one except their intended victim. Ladies of the upper classes, travelling in their chairs to meet evening engagements, were quietly turned back. The shopkeeper in the West Bow, whose place was broken into for a coil of rope, found himself reimbursed with a guinea. The town guard was disarmed and the city gates closed without confusion, showing that cool heads were in the lead. The jail was stormed and, as the door would not yield, it was set on fire. When this finally became effective, the fire was extinguished. All the prisoners were set free except Porteous, who was taken to the Grassmarket and hanged on a post near the scene of his own crime.

The event caused great excitement, not only in Edinburgh, but in London. The House of Lords proposed a severe punishment, including the imprisonment of the Lord Provost, but finally compromised with a fine upon the city of £2000 for the benefit of Porteous's widow, thus throwing the punishment upon those who had nothing to do with the affair and could not have prevented it.

When the discreditable old Tolbooth was finally demolished, Scott was presented with the door and its frame, which are now built into the outer walls of the mansion at Abbotsford and the keys of the prison are among the treasures of his museum. In 1816, he wrote to Terry, 'I expect to get some decorations from the old Tolbooth of Edinburgh, particularly the copestones of the doorway, or lintels, as we call them, and a niche or two—one very handsome, indeed! Better a niche from the Tolbooth than a niche in it, to which such building operations are apt to bring the projectors!'

The first part of the novel is a skilful blending of the history of the Porteous Mob, with the true story of an unfortunate girl and her noble sister, who lived in another part of Scotland. The author represents Effie Deans as having been incarcerated in the old Tolbooth and places her trial in one of the buildings of Parliament Close. The real Effie was imprisoned in the jail at Dumfries and her trial occurred in an upper room of a curious old building of that city, known as the Mid-Steeple, a structure, now over two centuries old, which stands in the middle of the High Street and gives a picturesque effect to that thoroughfare. On the south front, above a stairway which ascends across the face of the building, is a sculptured figure of St. Michael treading on a serpent, the arms of the burgh, and above this are the royal arms of Scotland, also carved in stone. The space in front is given a pleasant bit of colour by the display of flowers and vegetables, here offered for sale.

The story of Helen Walker, the original of Jeanie Deans, is well remembered in Dumfries. A stone or two may still be discovered, by those who care to search for the remnant of her little cottage, near the banks of the river Cluden. She lived to be seventy or eighty years old, supporting herself by working stocking-feet and raising chickens, besides occasionally teaching a few children to read. In early life she had been left an orphan, charged with the support of a younger sister, named Isabella, or 'Tibby,' to whom she devoted herself with many evidences of genuine affection. It was a great shock to her, therefore, when she learned that the young girl had been accused of child-murder and that she herself would be called upon as the principal witness against her. Under the law, as her counsel explained, if she could testify that her sister had made the slightest preparation or had even confided to her an intimation on the subject, such a declaration would save her sister's life. The temptation to tell a plausible lie, which no one could dispute, was undeniably strong. But Helen was a woman of finer mould, and not even the purest sisterly love could induce her to violate her conscience. She swore to the truth and Isabella was condemned. As she left the court, the latter was heard to exclaim, 'Oh, Nelly! ye've been the cause of my death!'

The same moral courage which gave resolution to Helen Walker to stand for the truth, now impelled her to a remarkable exercise of the power of an indomitable will. The difficulties seemed insurmountable. There was no hope except in the royal pardon. There was no one to intercede with the King and London was many miles away. But Helen did not waste a moment. A petition was hastily drawn, setting forth the facts in the case, and on the very night of the conviction, the dauntless Scotch lassie set out on foot for London, clad in her simple country dress and tartan plaid, without letters of introduction or recommendation, with little money in her purse, and scarcely a chance of success except a sublime faith in Providence and reliance upon her own stout heart.

There was one nobleman in London to whom the heart of any of his Scotch countrymen would instinctively turn in such an emergency. This was John, Duke of Argyle, who had stoutly resisted the efforts to inflict an undeserved punishment on the people of Edinburgh for their part in the Porteous affair. To him Helen Walker presented herself, after watching three days at his door, just as he was about to enter his carriage. Her unpretentious dress, her honest face, and the pathos of her story won the heart of the generous nobleman, who procured the pardon and forwarded it to Dumfries. Helen returned on foot as she had come, and had the satisfaction of witnessing the release of her sister. Isabella married the man who had wronged her and lived many years, always acknowledging in the most affectionate terms the high nobility of her sister's character.