The latter became a new state, the third kingdom associated with the Crown of Aragon, with its own court and a new "fuero" (code of laws): the "Furs de Valencia". In contrast, the Majorcan territory together with that of the counties of Cerdanya, Vallespir, Capcir and Roussillon and the city of Montpellier were left as a kingdom for his son James II of Majorca as the Kingdom of Majorca. This division began a period of struggle that ended with the annexation of that kingdom by the Crown of Aragon in 1344 by Peter IV "the Ceremonious".