City status in Ireland tended historically to be granted by royal charter. There are many towns in Ireland with Church of Ireland cathedrals that have never been called cities. In spite of this, Armagh was considered a city, by virtue of its being the seat of the Primate of All Ireland, until the abolition of Armagh's city corporation by the Municipal Corporations (Ireland) Act 1840. The only historic city with a charter in present-day Northern Ireland is Derry. Derry was given its first charter by James I in 1604, but the garrison was attacked and destroyed by Cahir O'Doherty in 1608. The present city is the result of a second charter granted in 1613 to members of the London guilds, as part of the Plantation of Ulster, providing for the building of a walled city, which was renamed Londonderry.