Ireland had been at war since the rebellion of 1641, with most of the island being controlled by the Irish Confederates. In 1648, in the wake of Charles I's arrest, and the growing threat to them from the armies of the English Parliament, the Confederates signed a treaty of alliance with the English Royalists. The joint Royalist and Confederate forces under Ormonde attempted to eliminate the Parliamentary army holding Dublin, but were routed at the battle of Rathmines by a Parliamentary army commanded by Colonel Michael Jones. As the former Member of Parliament Admiral Robert Blake blockaded Prince Rupert of the Rhine's fleet in Kinsale, Oliver Cromwell was able to land at Dublin on 15 August 1649 with the army to quell Royalist alliance in Ireland. The alliance, which was a compromise that gave command of the Irish Confederate forces to the English Royalists, was very shaky from the start, with many Confederates unhappy with the leadership of Ormonde. Indeed, the Confederates had fought a mini civil war among themselves in 1648 over this alliance, with Owen Roe O'Neill's Ulster army leaving the Confederation and only re-joining it after Cromwell had actually landed in Ireland. Partly as a result of this disunity, the Irish/Royalist coalition was driven from eastern Ireland by Cromwell, who beat down all resistance by his skill, and even more by his ruthless severity, in a brief campaign of nine months . At the end of May 1650 Cromwell turned over his command in Ireland to Henry Ireton and returned to England. It took two more years of prolonged siege and guerrilla warfare, before the last major Irish resistance was ended, after the fall of Galway in late 1652. The last Confederate Catholic troops surrendered in mid-1653.
Question: How many years was Ireland at war before the they signed a treaty of alliance with the English Royalists?
Answer: 7