Born in Coimbra, Afonso spent much of his early life in France. In 1238, he married Countess Matilda II of Boulogne, which elevated him to the title of Count of Boulogne, Mortain, Aumale, and Dammartin-en-Goële.
Conflicts between Afonso's elder brother, King Sancho II, and the Church reached a breaking point in 1246. Pope Innocent IV issued an order to remove Sancho II from the throne, replacing him with the Count of Boulogne. Accepting the papal order, Afonso returned to Portugal. Sancho's unpopularity made the transition relatively smooth, and he fled to exile in Toledo, Castile, where he passed away in 1248. Until his own coronation, Afonso assumed the title of Visitador, Curador e Defensor do Reino (Overseer, Curator, and Defender of the Kingdom).
In 1248, Afonso abdicated his rights to the county of Boulogne to ascend the throne. He divorced Matilda in 1253 and married Beatrice of Castile, the illegitimate daughter of Alfonso X, King of Castile, and Mayor Guillén de Guzmán. Afonso III was determined not to repeat the mistakes of his predecessor. He valued the opinions of the middle class, comprising merchants and small landowners, and in 1254, he convened the Cortes, a general assembly that included nobility, the middle class, and municipal representatives. Through legislation, he sought to protect the rights of the common people and restrict abuses by the upper classes. Afonso III's administration skills were widely recognized, leading to the foundation of new towns and the granting of city titles to several others. He also implemented significant reforms in public administration.
Notably progressive for his time, Afonso III implemented measures that set him apart as a visionary ruler. The inclusion of representatives from the commons in governance, the requirement for judicial review of arrests, and fiscal innovations such as negotiating taxes with merchant classes and directly taxing the Church showcased his forward-thinking approach. These actions, however, likely led to his excommunication by the Holy See and possibly hastened his death, resulting in his son Denis ascending the throne at a young age of 18.
Having consolidated his power, Afonso III turned his attention to the Muslim communities in the south. His reign witnessed the incorporation of the Algarve region into the Portuguese kingdom, following the capture of Faro. With this success, Afonso faced political challenges concerning Portugal's borders with Castile. Castile claimed that the newly acquired Algarve lands should be theirs, leading to a series of conflicts between the two kingdoms. The Treaty of Badajoz was eventually signed in 1267, defining the southern border between Castile and Portugal as the River Guadiana, a demarcation that remains in effect to this day.
Afonso III passed away at the age of 68 in Alcobaça, Coimbra, or Lisbon. His marriages produced no surviving children with Matilda, but his union with Beatrice of Castile resulted in several descendants who would continue to shape Portugal's history.
King Afonso III left a lasting legacy as a ruler with a clear vision for his kingdom's progress. His reforms and policies, guided by a concern for the common people, marked a turning point in Portugal's development. His ability to navigate political challenges and consolidate power allowed Portugal to expand its territories and secure its borders. Afonso III's reign stands as a testament to his enduring impact on the history and destiny of Portugal.