In the 13th century, a military dispute arose between the bishop of Urgell and the count of Foix as aftermath of the Cathar Crusade. The conflict was resolved in 1278 with the mediation of the king of Aragon, Peter III, between the bishop and the count, by the signing of the first paréage which provided that Andorra's sovereignty be shared between the count of Foix (whose title would ultimately transfer to the French head of state) and the bishop of Urgell, in Catalonia. This gave the principality its territory and political form.