Moray had been appointed Regent of Scotland after his half-sister Mary abdicated in 1567, and had subsequently clashed with her and her supporters.
He burnt down Rutherglen Castle in 1569 in retaliation against the Hamiltons for supporting Mary.
James Hamilton decided to assassinate Moray and travelled to the Borders, Edinburgh, York, London, Perth, Glasgow and Stirling without an opportunity arising.
Finally Moray went from Stirling to Linlithgow, where he stopped at the house of the Provost, Charles Drummond, the brother of Sir Robert Drummond of Carnock.

When Moray left the house to go to Edinburgh, the chance for revenge presented itself.
Hamilton, who had six accomplices drawn from his close family, prepared the assassination carefully, gaining access to a Hamilton family property which had a projecting gallery.
John Knox told his secretary, Richard Bannatyne of the danger in Linlithgow, and Bannatyne warned Regents Moray's wife, Agnes Keith.
She sent Moray's secretary Master John Wood to alert her husband.
Knox's source had told him that the attempt would be on the High Street, near the cross, and an alternative route to avoid the Archbishop's house was suggested in vain.

The details of Hamilton's preparations were conjectured in a fictionalised account by Leitch Ritchie.
In Ritchie's story, James placed feathers on the ground to deaden his footsteps, hanging a black cloth on the wall to hide his shadow and obtaining a brass match-lock carabine with a rifled barrel for accuracy.
The weapon was long preserved at Hamilton Palace.
All entrances were either barricaded or stuffed with spiny gorse, and as contemporary sources relate, he had a saddled horse waiting.
Moray had been appointed Regent of Scotland after his half-sister Mary abdicated in 1567, and had subsequently clashed with her and her supporters. He burnt down Rutherglen Castle in 1569 in retaliation against the Hamiltons for supporting Mary. James Hamilton decided to assassinate Moray and travelled to the Borders, Edinburgh, York, London, Perth, Glasgow and Stirling without an opportunity arising. Finally Moray went from Stirling to Linlithgow, where he stopped at the house of the Provost, Charles Drummond, the brother of Sir Robert Drummond of Carnock.
When Moray left the house to go to Edinburgh, the chance for revenge presented itself. Hamilton, who had six accomplices drawn from his close family, prepared the assassination carefully, gaining access to a Hamilton family property which had a projecting gallery. John Knox told his secretary, Richard Bannatyne of the danger in Linlithgow, and Bannatyne warned Regents Moray's wife, Agnes Keith. She sent Moray's secretary Master John Wood to alert her husband. Knox's source had told him that the attempt would be on the High Street, near the cross, and an alternative route to avoid the Archbishop's house was suggested in vain.
The details of Hamilton's preparations were conjectured in a fictionalised account by Leitch Ritchie. In Ritchie's story, James placed feathers on the ground to deaden his footsteps, hanging a black cloth on the wall to hide his shadow and obtaining a brass match-lock carabine with a rifled barrel for accuracy. The weapon was long preserved at Hamilton Palace. All entrances were either barricaded or stuffed with spiny gorse, and as contemporary sources relate, he had a saddled horse waiting.
James Hamilton (assassin)