In his early years, Afonso IV faced a turbulent relationship with his father and half-brother, Afonso Sanches. Despite being the rightful heir to the Portuguese throne, he was not his father's favorite, as King Denis preferred Afonso Sanches, his illegitimate son. This rivalry between the half-brothers led to civil war on multiple occasions. However, upon his father's death in 1325, Afonso IV ascended to the throne and exiled Afonso Sanches to Castile, stripping him of his lands and titles.

During his reign, Afonso IV faced external challenges as well. In 1309, he married Beatrice of Castile, daughter of King Sancho IV of Castile and María de Molina. Their union resulted in the birth of their daughter, Maria of Portugal. However, tensions arose when Alfonso XI of Castile annulled his child-marriage with Constanza Manuel of Castile to marry Maria of Portugal. This public scandal and Alfonso XI's involvement with a mistress led to political turmoil between Portugal and Castile.

Afonso IV, devastated by the public humiliation of his daughter, arranged for his son and heir, Peter I of Portugal, to marry the aggrieved Castilian infanta, Constanza. This decision further escalated tensions, leading to a war between Portugal and Castile. Eventually, peace was achieved through the intervention of Maria, who was now Queen of Castile. In 1340, Portuguese troops played a vital role in the Battle of Río Salado, defeating the Moors.

The latter part of Afonso IV's reign was marked by political intrigue and familial drama. After the death of Alfonso XI, a civil war erupted in Castile. Henry of Trastámara challenged the newly crowned King Peter of Castile, causing many Castilian nobles to seek exile in Portugal. Meanwhile, Afonso's son, Peter, fell in love with Inês de Castro, his new wife's lady-in-waiting. The relationship between Peter and Inês became a source of contention at the Portuguese court, as her family had connections to both the royal houses of Castile and Portugal.

Afonso IV, concerned about the growing power of Castile within Portugal's borders and the well-being of his legitimate grandson, ordered Inês de Castro to be imprisoned and later murdered in 1355. He hoped that Peter would give up his infatuation and arrange a dynastic marriage. However, this act only intensified Peter's anger, and he led an army to devastate the country until he was reconciled with his father in 1357. Tragically, Afonso IV died shortly after the reconciliation, in May 1357, in Lisbon.

Despite his reputation as a brave warrior, Afonso IV's most significant achievements lay in preserving relative peace within the country during his reign and fostering the growth of the Portuguese Navy. He provided public funding to establish a commercial fleet and initiated the first Portuguese maritime explorations. These explorations, along with the conflicts involving Peter and Inês, became the foundation of the Portuguese national epic, "Os Lusíadas" by Luís de Camões.

The story of Afonso IV's reign, particularly the tragic tale of his son's love affair, captivated the imagination of artists and writers for centuries. It served as inspiration for numerous operas, ballets, plays, and poems in both Portuguese and Spanish literature. The emotional intensity and dramatic consequences of the events surrounding Inês de Castro's murder continue to resonate in the realms of art and storytelling.

Afonso IV of Portugal, the Brave King who navigated through political challenges, supported maritime exploration, and shaped the destiny of his nation, remains an important figure in Portuguese history. His legacy lives on, not only in historical accounts but also in the enduring artistic works that immortalize the events and emotions of his remarkable reign.