Afonso III (; rare English alternatives: Alphonzo or Alphonse), or Affonso (Archaic Portuguese), Alfonso or Alphonso (Portuguese-Galician) or Alphonsus (Latin),  the Boulonnais (Port. o Bolonhês), King of Portugal (5 May 121016 February 1279) was the first to use the title King of Portugal and the Algarve, from 1249.
He was the second son of King Afonso II of Portugal and his wife, Urraca of Castile; he succeeded his brother, King Sancho II of Portugal, who died on 4 January 1248.
Early life
Afonso was born in Coimbra.
As the second son of King Afonso II of Portugal, he was not expected to inherit the throne, which was destined to go to his elder brother Sancho.
He lived mostly in France, where he married Countess Matilda II of Boulogne in 1238, thereby becoming count of Boulogne, Mortain, Aumale and Dammartin-en-Goële jure uxoris.
Reign
In 1246, conflicts between his brother, the king, and the church became unbearable.
In 1247, Pope Innocent IV ordered Sancho II to be removed from the throne and to be replaced by the Count of Boulogne.
Afonso, of course, did not refuse the papal order and consequently marched to Portugal.
Since Sancho was not a popular king the order was not hard to enforce, and he fled in exile to Toledo, Castile, where he died on 4 January 1248.
Until his brother's death and his own eventual coronation, Afonso retained and used the title of Visitador, Curador e Defensor do Reino (Overseer, Curator and Defender of the Kingdom).
In order to ascend the throne Afonso abdicated his rights to the county of Boulogne in 1248.
In 1253, he divorced Matilde in order to marry Beatrice of Castile, illegitimate daughter of Alfonso X, King of Castile, and Mayor Guillén de Guzmán.
Determined not to make the same mistakes as his brother, Afonso III paid special attention to what the middle class, composed of merchants and small land owners, had to say.
In 1254, in the city of Leiria, he held the first session of the Cortes, a general assembly comprising the nobility, the middle class and representatives of all municipalities.
He also made laws intended to restrain the upper classes from abusing the least favored part of the population.
Remembered as a notable administrator, Afonso III founded several towns, granted the title of city to many others and reorganized public administration.
Afonso showed extraordinary vision for the time.
Progressive measures 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
