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" starting 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, Henry became influenced by the desire of the lords of the county for independence which made him desire the independence of the county.

Henry died in 1112, and his wife Queen Theresa (Regina Tarasia, as she addressed herself) became the countess of Portugal. Her sister Queen Urraca became Queen of León after her father's, Alfonso VI of Leon, death. Like her husband, Theresa was also ambitious wished for independence from Leon and particularly her sister. In an attempt to maintain the autonomy of her county, at different times 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, 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 Urraca 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 Theresa's son, Afonso Henriques, because she had lost the trust of the Leonese king, and Afonso became the count of Portugal. Subsequently, Theresa became a puppet of the Galician Ferdinand Perez de Trava. Theresa and Prince Afonso therefore 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:
 Afonso Nunes de Barbosa (1131)
 D. Paio Mendes da Maia (Archbishop of Braga)
 Egas Moniz de Cresconhe
 Egas Moniz de Ribadouro (1108–1146)
 Ermígio Moniz de Ribadouro (1128–1135)
 Fernão Captivo (Alferes-Mor)
 Garcia Soares
 Godinho Fafes de Lanhoso
 Gonçalo Mendes da Maia (O Lidador)
 Gonçalo Mendes de Sousa (1154–1167)
 Nuno Soares Velho (1117–1162)
 Paio Ramires Ramirão
 Sancho Nunes de Barbosa (1114–1169)
 Soeiro Mendes de Sousa (1121–1137)

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.

Further reading
 Anderson, James Maxwell (2000). The History of Portugal online
 Birmingham, David. A Concise History of Portugal (Cambridge, 1993)
 Grissom, James. (2012) Portugal – A Brief History excerpt and text search
 Oliveira Marques, A. H. de. History of Portugal: Vol. 1: from Lusitania to empire; Vol. 2: from empire to corporate state (1972).
 Nowell, Charles E. A History of Portugal (1952) online
 Payne, Stanley G. A History of Spain and Portugal (2 vol 1973) full text online vol 2 after 1700; standard scholarly history; chapter 23

Historiography
 Campos Matos, Sérgio. "History of Historiography and National Memory in Portugal," History Compass (Oct 2012) 10#10 pp 765–777.
 de Carvalho Homem, Armando Luís. "A. H. de Oliveira Marques (1933–2007): Historiography and Citizenship," E-Journal of Portuguese History (Winter 2007) 5#2 pp 1–9.

External links 

Portugal Chronology World History Database
History of Portugal: Primary documents

1128 in Europe
12th century in Portugal
São Mamede
Battles involving Portugal
County of Portugal