For most of the 13th century, weak kings in England saw their control over the bordering territories diminish. Although an anti-Norman Gaelic alliance was beaten at Down (1260) in northern Ireland, the independent Irish chieftains drove out their English-Norman overlords between 1261–74. By the 14th century the English residue huddled round Dublin behind the protection of the Pale, the territory under English control. Over the 13th century, the Llywellyns developed a powerful independent kingdom in Wales, reaching its apogee in the 1267 Treaty of Montgomery. Scottish independence was more at threat from the Norwegian kings than England for most of the 13th century; Hakon IV invaded in 1263, but was defeated at the Battle of Largs, Scotland gaining control of the Western Isles by the 1266 Treaty of Perth. Edward I dramatically reversed this pattern, first subjugating Wales in the 1270s and then, in the 1290s, becoming ‘Hammer of the Scots’.