When James I the Conqueror, king of Aragon and count of Barcelona, founded in 1229 the Kingdom of Majorca, Perpignan became the capital of the territory on the mainland. This continued from 1278 to 1344. The "Castle of the Kings of Majorca" () was built during this period. The different parts of the kingdom were the Balearic Islands, Northern Catalonia (Roussillon and Cerdagne) and the coastal area of Montpellier.