One of the most important events of the reign of Ferdinand IV once reached his majority, was the agreement of borders established with James II of Aragon in 1304, and known in history as the Treaty of Torrellas —called a sentencia arbitral, "sentence by arbitration," in Castilian—. With the agreement also tried to put an end to the claims of Alfonso de la Cerda, pretender to the Castilian-Leonese throne.

On 8 August 1304, in the town of Torrellas, King Denis of Portugal, the Archbishop of Zaragoza, Jimeno de Luna (who represented the Kingdom of Aragon) and John of Castile (who represented the Kingdom of Castile), made public the clauses of the Treaty of Torrellas.
The purpose of the negotiation was to put an end to the existing disputes between the Kingdoms of Castile and Aragon with respect to the possession of the Kingdom of Murcia.
Sultan Muhammed III of Granada participated in the conversations at the request of Ferdinand IV, who ordered that the Granadian ruler intervene in the Treaty and alliance between the Christian Kingdoms of the peninsula, since he had an interest in preserving the friendship, submission and parias which every year Granada was obliged to pay to the King of Castile, and which constituted a precious resource.
Therefore, James II of Aragon and the Denis of Portugal both agreed to maintain good relations with the Sultan of Granada.

According to the terms of the Treaty, the Kingdom of Murcia, then in the hands of James II of Aragon, would be divided between the Kingdoms of Aragon and Castile, and along the Segura river would be established the southern border of Aragon.
The cities of Alicante, Elche, Orihuela, Novelda, Elda, Abanilla, Petrel, Crevillente and Sax, would continue in the hands of the Aragonese monarch.
In the Treaty was also recognized the possession by the Kingdom of Castile of the cities of Murcia, Monteagudo, Alhama, Lorca and Molina de Segura.
Citizens affected by the change of sovereignty would be free to stay in their cities and towns if they wished, or they could freely leave the territory.
At the same time, both Kingdoms agreed to grant freedom to prisoners of war, as well as to be enemies of their common rivals, excepting the Holy See and the Kingdom of France.
The Seigneury of Villena continued in the hands of Prince Juan Manuel, but the lands in which it was settled would remain under Aragonese sovereignty.

On 8 August 1304, the Kings of Portugal and Aragon pronounced, in the presence of John of Castile, about the claims of the Infantes de la Cerda.
Alfonso de la Cerda, supported by James II of Aragon, was granted as compensation for his resignation to the throne of Castile several lordships and possessions (although dispersed throughout the Castilian-Leonese territory in order to avoid the formation of a microstate), who included Alba de Tormes, Valdecorneja, Gibraleón, Béjar and Real de Manzanares, in addition to the castle of Monzón de Campos, Gatón de Campos, La Algaba, and Lemos.
In addition, Alfonso de la Cerda received numerous rents and possessions in Medina del Campo, Córdoba, Toledo, Bonilla and Madrid.
Ferdinand IV, who wished that his cousin Alfonso de la Cerda enjoyed an annual income of 400,000 maravedíes, ordered that if the income of the possessions that had been granted to him didn't reach that amount he would give him other territories until the incomes reached the expected amount.
At the same time it was arranged that, as a proof that the Castilian monarch would gave these lands to Alfonso de la Cerda, the castles of Alfaro, Cervera, Curiel de los Ajos and Gumiel would be granted to four ricoshombres for thirty years.

For his part, Alfonso de la Cerda renounced his rights to the Castilian-Leonese throne, to use the royal titles, and to use the royal seal.
At the same time, he promise to return to the King the cities of Almazan, Soria, Deza, Serón, Alcalá, and Almenara.
However, he soon used the royal symbols  again, contrary to what was agreed in Torrellas.
The question of the rights to the throne of Alfonso de la Cerda was finally settled during the reig
One of the most important events of the reign of Ferdinand IV once reached his majority, was the agreement of borders established with James II of Aragon in 1304, and known in history as the Treaty of Torrellas —called a sentencia arbitral, "sentence by arbitration," in Castilian—. With the agreement also tried to put an end to the claims of Alfonso de la Cerda, pretender to the Castilian-Leonese throne.
On 8 August 1304, in the town of Torrellas, King Denis of Portugal, the Archbishop of Zaragoza, Jimeno de Luna (who represented the Kingdom of Aragon) and John of Castile (who represented the Kingdom of Castile), made public the clauses of the Treaty of Torrellas. The purpose of the negotiation was to put an end to the existing disputes between the Kingdoms of Castile and Aragon with respect to the possession of the Kingdom of Murcia. Sultan Muhammed III of Granada participated in the conversations at the request of Ferdinand IV, who ordered that the Granadian ruler intervene in the Treaty and alliance between the Christian Kingdoms of the peninsula, since he had an interest in preserving the friendship, submission and parias which every year Granada was obliged to pay to the King of Castile, and which constituted a precious resource. Therefore, James II of Aragon and the Denis of Portugal both agreed to maintain good relations with the Sultan of Granada.
According to the terms of the Treaty, the Kingdom of Murcia, then in the hands of James II of Aragon, would be divided between the Kingdoms of Aragon and Castile, and along the Segura river would be established the southern border of Aragon. The cities of Alicante, Elche, Orihuela, Novelda, Elda, Abanilla, Petrel, Crevillente and Sax, would continue in the hands of the Aragonese monarch. In the Treaty was also recognized the possession by the Kingdom of Castile of the cities of Murcia, Monteagudo, Alhama, Lorca and Molina de Segura. Citizens affected by the change of sovereignty would be free to stay in their cities and towns if they wished, or they could freely leave the territory. At the same time, both Kingdoms agreed to grant freedom to prisoners of war, as well as to be enemies of their common rivals, excepting the Holy See and the Kingdom of France. The Seigneury of Villena continued in the hands of Prince Juan Manuel, but the lands in which it was settled would remain under Aragonese sovereignty.
On 8 August 1304, the Kings of Portugal and Aragon pronounced, in the presence of John of Castile, about the claims of the Infantes de la Cerda. Alfonso de la Cerda, supported by James II of Aragon, was granted as compensation for his resignation to the throne of Castile several lordships and possessions (although dispersed throughout the Castilian-Leonese territory in order to avoid the formation of a microstate), who included Alba de Tormes, Valdecorneja, Gibraleón, Béjar and Real de Manzanares, in addition to the castle of Monzón de Campos, Gatón de Campos, La Algaba, and Lemos. In addition, Alfonso de la Cerda received numerous rents and possessions in Medina del Campo, Córdoba, Toledo, Bonilla and Madrid. Ferdinand IV, who wished that his cousin Alfonso de la Cerda enjoyed an annual income of 400,000 maravedíes, ordered that if the income of the possessions that had been granted to him didn't reach that amount he would give him other territories until the incomes reached the expected amount. At the same time it was arranged that, as a proof that the Castilian monarch would gave these lands to Alfonso de la Cerda, the castles of Alfaro, Cervera, Curiel de los Ajos and Gumiel would be granted to four ricoshombres for thirty years.
For his part, Alfonso de la Cerda renounced his rights to the Castilian-Leonese throne, to use the royal titles, and to use the royal seal. At the same time, he promise to return to the King the cities of Almazan, Soria, Deza, Serón, Alcalá, and Almenara. However, he soon used the royal symbols  again, contrary to what was agreed in Torrellas. The question of the rights to the throne of Alfonso de la Cerda was finally settled during the reig
Ferdinand IV of Castile