The Babington Plot was a plan in 1586 to assassinate Queen Elizabeth I, a Protestant, and put Mary, Queen of Scots, her Roman Catholic cousin, on the English throne. It led to the Queen of Scots' execution, a direct result of a letter sent by Mary (who had been imprisoned for 19 years since 1568 in England at the behest of Elizabeth) in which she consented directly to the assassination of Elizabeth.
The long-term goal of the plot was the invasion of England by the Spanish forces of King Philip II and the Catholic League in France, leading to the restoration of the old religion. The plot was discovered by Elizabeth's spymaster Sir Francis Walsingham and used to entrap Mary for the purpose of removing her as a claimant to the English throne.
The chief conspirators were Anthony Babington and John Ballard. Babington, a young recusant, was recruited by Ballard, a Jesuit priest who hoped to rescue the Scottish Queen. Working for Walsingham were double agents Robert Poley and Gilbert Gifford, as well as Thomas Phelippes, the last a spy agent and cryptanalyst. The turbulent Catholic deacon Gifford had been in Walsingham's service since the end of 1585 or the beginning of 1586. Gifford obtained a letter of introduction to Queen Mary from a confidant and spy for her, Thomas Morgan. Walsingham then placed double agent Gifford and spy decipherer Phelippes inside Chartley Castle, where Queen Mary was imprisoned. Gifford organised the Walsingham plan to place Babington's and Queen Mary's encrypted communications into a beer barrel cork which were then intercepted by Phelippes, decoded and sent to Walsingham.