taken during his kingship include: representatives of the commons, besides the nobility and clergy, were involved in governance; the end of preventive arrests such that henceforward all arrests had to be first presented to a judge to determine the detention measure; and fiscal innovation, such as negotiating extraordinary taxes with the mercantile classes and direct taxation of the Church, rather than debasement of the coinage. These may have led to his excommunication by the holy see and possibly precipitated his death, and his son Denis's premature rise to the throne at only 18 years old. Secure on the throne, Afonso III then proceeded to make war with the Muslim communities that still thrived in the south. In his reign the Algarve became part of the kingdom, following the capture of Faro. Final years and death Following his success against the Moors, Afonso III had to deal with a political situation concerning the country's borders with Castile. The neighbouring kingdom considered that the newly acquired lands of the Algarve should be Castilian, not Portuguese, which led to a series of wars between the two kingdoms. Finally, in 1267, the Treaty of Badajoz (1267) was signed in Badajoz, determining that the southern border between Castile and Portugal should be the River Guadiana, as it is today. Afonso died in Alcobaça, Coimbra or Lisbon, aged 68. Marriages and descendants Afonso's first wife was Matilda II, Countess of Boulogne, daughter of Renaud, Count of Dammartin, and Ida, Countess of Boulogne. They had no surviving children. He divorced Matilda in 1253 and, in the same year, married Beatrice of Castile, illegitimate daughter of Alfonso X, King of Castile, and Mayor Guillén de Guzmán. References Portuguese Roman Catholics Portuguese infantes House of Burgundy-Portugal People of the Reconquista 1210 births 1279 deaths People from Coimbra 13th-century Portuguese monarchs Jure uxoris officeholders Counts of Mortain Counts of Aumale Counts of Dammartin Counts of Boulogne