The Irish Free State (Ir: Saorstat Eireann)was created by treaty with the United Kingdom in 1922 following the Irish War of Independence of 1919-1921. The treaty created an all-Ireland dominion but included a provision that allowed Northern Ireland to leave the new state and rejoin the United Kingdom. The parliament of Northern Ireland exercised this option almost immediately, leaving the 26 counties that today comprise the Republic of Ireland. It was to be in external association with the United Kingdom, and members of its legislature had to take an oath of allegiance to the British monarch. In addition, the British Royal Navy retained the rights to use a number of Irish harbours. The question of the oath of allegiance, rather than acceptance of the partition of Ireland, led to a deep split in Sinn Fein and the IRA and the consequent Irish Civil War of 1922-23 between the Free State Army and the Anti-Treaty IRA. In the event, the oath was quietly abandoned and in 1937 a new Irish constitution was drawn up which removed most of the remaining links. In 1938 sovereignty over the 'treaty ports' was returned to Ireland, and in 1949 a further new constitution established Ireland as a republic.