Most of Ireland seceded from the United Kingdom after the Irish War of Independence and the subsequent Anglo-Irish Treaty (1919–1922), with six counties remaining in the UK as Northern Ireland.