The Anglo-Scottish war (1650–1652), also known as the Third Civil War, was the final conflict in the Wars of the Three Kingdoms, a series of armed conflicts and political machinations between shifting alliances of religious and political factions in England, Scotland and Ireland. The 1650 English invasion was a pre-emptive military incursion by the English Commonwealth's New Model Army, intended to allay the risk of Charles II invading England with a Scottish army. The First and Second English Civil Wars, in which English Royalists, loyal to Charles I, fought Parliamentarians for control of the country, took place between 1642 and 1648. When the Royalists were defeated for the second time the English government, exasperated by the duplicity of Charles I during negotiations, set up a High Court of Justice which found the King guilty of treason and executed him on 30 January 1649. At the time, England and Scotland were separate independent kingdoms, joined politically through a personal union; Charles I was, separately, both the king of Scotland, and the king of England. The Scots had fought in support of the English Parliamentarians in the First English Civil War, but sent an army in support of Charles I into England during the Second. The Parliament of Scotland, which had not been consulted before the execution, declared his son, Charles II, King of Britain. In 1650 Scotland was rapidly raising an army. The leaders of the English Commonwealth government felt threatened and on 22 July the New Model Army under Oliver Cromwell invaded Scotland. The Scots, commanded by David Leslie, retreated to Edinburgh and refused battle. After a month of manoeuvring, Cromwell unexpectedly led the English army out of Dunbar in a night attack on 3 September and heavily defeated the Scots. The survivors abandoned Edinburgh and withdrew to the strategic bottleneck of Stirling. The English secured their hold over southern Scotland, but were unable to advance past Stirling. On 17 July 1651 the English crossed the Firth of Forth in specially constructed boats and defeated the Scots at the Battle of Inverkeithing on 20 July. This cut off the Scottish army at Stirling from its sources of supply and reinforcements. Charles II, believing that the only alternative was surrender, invaded England in August. Cromwell pursued, few Englishmen rallied to the Royalist cause and the English raised a large army. Cromwell brought the badly outnumbered Scots to battle at Worcester on