The Rock of Gibraltar was first fortified with the Moorish Castle in 710 AD. It was the site of ten sieges during the Middle Ages, some of them successful. An Anglo-Dutch force captured the Gibraltar peninsular in 1704 during the War of the Spanish Succession; possession was assigned to Britain in the 1713 peace Treaty of Utrecht that ended the war. The Spanish made an unsuccessful attempt to recapture Gibraltar in 1727 during the Anglo-Spanish War (1727–1729). After the war ended with the Treaty of Seville (1729), in 1730 Spain built a line of fortifications across the north of the peninsula, cutting Gibraltar off from the mainland.