The Battle of São Mamede took place on 24 June 1128 near Guimarães and is considered the seminal event for the foundation of the Kingdom of Portugal and the battle that ensured Portugal's Independence. Portuguese forces led by Afonso Henriques defeated forces led by his mother Teresa of Portugal and her lover Fernão Peres de Trava. Following São Mamede, the future king styled himself "Prince of Portugal". He would be called "King of Portugal" in 1139 and was recognised as such by neighbouring kingdoms in 1143.
Background
In late 11th century, Henry of Portugal, a knight and brother of the Duke of Burgundy, went to support the Christians of Hispania. He fought the Moors along with Alfonso VI of León. In honour of his fights in Hispania, the King gave him the County of Portugal. This gift came with a reinstated title; because of attempts by the previous holder some years earlier to assert independence, it had been suppressed. Henry became count of Portugal and Theresa, one of Alfonso's daughters, his wife. In 1095, the county was a dependency of the Kingdom of Galicia, itself a dependency of the Kingdom of León. In 1097 Portugal became a direct dependency of León. However, from the early years of his rule, as he became influenced by the desire of the lords of the county for independence, Henry desired the independence of the county. Henry died in 1112, and his wife Regina Tarasia became the countess of Portugal. She also wished for independence from her sister, Urraca, who became Queen of León after her father's, Alfonso VI of Leon, death. Like her husband, Theresa was also ambitious. In an attempt to maintain the autonomy of her county, she allied herself to her sister's enemies or with her sister, whichever was most propitious at the time. In 1116, the Portuguese took two Galician cities, Tui and Ourense. In reply, the sister of Countess Theresa, Queen Urraca, attacked Theresa's dominions. Bishop Diego Gelmírez, a friend of a Galician noble that was in the service of Theresa, led a revolt in the camp of Queen Urraca, and she was obliged to make peace with her sister Theresa. Urraca died in 1126. Urraca's son, Alfonso VII, became king of León and Castile and demanded that Theresa become his vassal, which she refused to do. In response, Alfonso attacked Portugal in the spring of 1127. This increased the power of her son, because she had lost the trust of the Leonese king, and her son became the count of Portugal. Theresa became a puppet of the Galician Ferdinand Perez de Trava. Theresa and Prince Afonso became enemies, as both wanted to take control of the county, but only the supporters of Prince Afonso were really interested in full independence.
The battle
Afonso Henriques was not alone in the battle. In fact, he was pressured by the lords of the main Portuguese cities, by the local church, and by its people to achieve the country's independence. Nobles participating in the battle with Afonso Henriques:
The counts that dominated the counties of Portugal and Coimbra kept the idea of independence, and their merger strengthened their positions. Alfonso VI of León, knowing the wishes of the Portuguese, united all Galicia under a single rule of one lord, which he chose from one of his close relatives. Teresa, mother of Afonso Henriques, came to Guimarães to govern the Portuguese county. The Portuguese did not accept this, and the battle started. Afonso won the battle and Portugal started its journey towards independence.
Post battle
In 1129, Henriques declared himself Prince of Portugal and in 1139 as King of Portugal. León finally recognized Portugal's independence in 1143 in the Treaty of Zamora. In 1179, the Holy See declared him King, de jure.
Historiography
Campos Matos, Sérgio. "History of Historiography and National Memory in Portugal," History Compass 10#10 pp 765–777.
de Carvalho Homem, Armando Luís. "A. H. de Oliveira Marques : Historiography and Citizenship," E-Journal of Portuguese History 5#2 pp 1–9.