The Kingdom of Portugal was established from the county of Portugal in the 1130s, ruled by the Portuguese House of Burgundy. During most of the 12th and 13th centuries, its history is chiefly that of the gradual reconquest of territory from the various Muslim principalities (taifas) of the period.
This process was essentially complete with the ascension of Afonso III of Portugal, the first to claim the title of King of Portugal and the Algarve. The history of Portugal in the period between the death of Afonso III in 1279 and the beginning of the Portuguese Empire in 1415 includes the 1383–1385 Portuguese interregnum and the subsequent transition from the Portuguese House of Burgundy to the House of Aviz.
Background Towards the close of the 11th century crusading knights came from every part of Europe to aid the kings of León, Castile and Aragon in fighting the Moors. Among these adventurers was Henry of Burgundy, who, in 1095, married Teresa of León, illegitimate daughter of Alfonso VI of León and Castile. The County of Portugal was included in Teresa's dowry. Count Henry ruled as a vassal of Alfonso VI, whose Galician marches were thus secured against any sudden Moorish raid. But in 1109 Alfonso VI died, bequeathing all his territories to his legitimate daughter, Urraca of León, and Count Henry at once invaded León, hoping to add it to his own dominions at the expense of his suzerain.
After three years of war against Urraca and other rival claimants to the throne of León, Count Henry himself died in 1112, leaving his widow Teresa to govern Portugal north of the Mondego during the minority of her infant son, Afonso Henriques; south of the Mondego, the Moors still ruled.
Teresa renewed the struggle against her half-sister and suzerain Urraca in 1116–1117, and again in 1120; in 1121 she was besieged in Lanhoso and captured. But a peace was negotiated (Treaty of Lanhoso) by the archbishops Diego Gelmírez and Burdino of Braga, rival churchmen whose wealth and military resources enabled them to dictate terms. Bitter jealousy existed between the two prelates, each claiming to be primate "of all Hispania", and their antagonism had some historical importance insofar as it fostered the growth of separatist tendencies among the Portuguese. But the quarrel was temporarily suspended because both Gelmires and Burdino, virtually princes within their territories, had reason to dread the extension of Urraca's authority. It was arranged that Teresa should be liberated and should continue to hold the county of Portugal as a fief of León. During the next five years she lavished wealth and titles upon her lover, Fernando Pérez de Traba, count of Trava, thus estranging her son, the archbishop of Braga and the nobles.
Meanwhile, her son Afonso Henriques (meaning "Afonso son of Henry") thrived. The boy, probably born around 1109, followed his father as Count of Portugal in 1112, under the tutelage of his mother. The relations between Teresa and her son Afonso proved difficult. Only eleven years old, Afonso already had his own political ideas, greatly different from his mother's. In 1120, the young prince took the side of the archbishop of Braga, a political foe of Teresa, and both were exiled by her orders. Afonso spent the next years away from his own county, under the watch of the bishop. In 1122 Afonso became fourteen, the adult age in the 12th century. He made himself a knight on his own account in Zamora Cathedral, raised an army, and proceeded to take control of his lands. Near Guimarães, at the Battle of São Mamede (1128) he overcame the troops under his mother's lover and ally, Count Fernando Pérez de Traba, making her his prisoner and exiling her forever to a monastery in Galicia. She died there in 1130. Thus Afonso become sole ruler (Duke of Portugal) after demands for independence from the county's people, church and nobles. He also vanquished Alfonso VII of León and Castile, his nominal suzerain, and thus freed the county from political dependence on the crown of León. On April 6, 1129, Afonso Henriques dictated the writ in which he proclaimed himself Prince of Portugal.
Afonso then turned his arms against the persistent problem of the Moors in the south. His campaigns were successful and, on July 25, 1139, he obtained an overwhelming victory in the Battle of Ourique, and straight after was unanimously proclaimed King of Portugal by his soldiers. This meant that Portugal was no longer a vassal county of León, but an independent kingdom in its own right. That he then convened the first assembly of the estates-general at Lamego (wherein he would have been given the crown from the Archbishop of Braga, to confirm the independence) is likely to be a 17th-century embellishment of Portuguese history.
Independence, however, was not a thing a land could choose on its own. Portugal still had to be acknowledged by the neighbouring lands and, most importantly, by the Catholic Church and the Pope. Afonso wed Matilda of Savoy, daughter of Amadeus III, Count of Savoy, and sent ambassadors to Rome to negotiate with the Pope. In Portugal, he built several monasteries and convents and bestowed important privileges to religious orders. In 1143, he wrote to Pope Innocent II to declare himself and the kingdom servants of the Church, swearing to pursue driving the Moors out of the Iberian Peninsula. Bypassing any king of Castile or León, Afonso declared himself the direct vassal of the Papacy. Thus, Afonso continued to distinguish himself by his exploits against the Moors, from whom he wrested Santarém and Lisbon in 1147. He also conquered an important part of the land south of the Tagus River, although this was lost again to the Moors in the following years.
Meanwhile, King Alfonso VII, Afonso's cousin, regarded the independent ruler of Portugal as nothing but a rebel. The conflict between the two was constant and bitter in the following years. Afonso became involved in a war, taking the side of the Aragonese king, an enemy of Alfonso VII. To ensure the alliance, his son Sancho was engaged to Dulce, sister of the Count of Barcelona and princess of Aragon. Finally, in 1143, the Treaty of Zamora established peace between the cousins and the recognition by the Kingdom of León that Portugal was an independent kingdom.
Afonso was occupied in almost incessant border fighting against his Christian or Moorish neighbours. Twelve years of campaigning on the Galician frontier were concluded in 1143 by the Treaty of Zamora, in which Afonso was recognized as independent of any other Iberian sovereign, although he promised to be a faithful vassal of the Pope and to pay him a yearly tribute of four ounces of gold. In 1167, however, the war was renewed. Afonso succeeded in conquering part of Galicia, but in attempting to capture the frontier fortress of Badajoz he was wounded and forced to surrender to Ferdinand II of León (1169). Ferdinand was his son-in-law and was probably disposed to leniency by the imminence of a Moorish invasion in which Portugal could render useful assistance. Afonso was therefore released under a promise to abandon all his conquests in Galicia.
In 1179 the privileges and favours given to the Roman Catholic Church were compensated. In the papal bull Manifestis Probatum, Pope Alexander III acknowledged Afonso as King and Portugal as an independent land with the right to conquer lands from the Moors. With this papal blessing, Portugal was at last secured as a country and safe from any Leonese attempts at annexation.
In 1184, in spite of his great age, King Afonso of Portugal still had sufficient energy to relieve his son Sancho, who was besieged in Santarém by the Moors. He died shortly after, on December 6, 1185.
Reconquista in Portugal
Afonso had already won many victories over the Moors. At the beginning of his reign the religious fervor which had sustained the Almoravid dynasty was rapidly subsiding; in Portugal independent Moorish chiefs ruled over cities and petty taifa states, ignoring the central government; in Africa the Almohades were destroying the remnants of the Almoravide power. Afonso took advantage of these dissentions to invade Alentejo, reinforced by the Templars and the Knights Hospitaller, whose respective headquarters were at Tomar and Soure.
On July 25, 1139 he defeated the combined forces of the Moors on the plains of Ourique, in Alentejo.Ribeiro 2004a, p. 60. Legend has magnified the victory into the rout of 200,000 Muslims under five kings; but so far was the battle from being decisive that in 1140 the Moors were able to seize the fortress of Leiria, built by Afonso in 1135 as an outpost for the defence of Coimbra, his capital. In 1144 they defeated the Templars at Soure. But on March 15, 1147 Afonso stormed the fortress of Santarém,Ribeiro 2004a, p. 69. and about the same time a band of crusaders on their way to Palestine landed at Porto on 16 June 1147, and volunteered for the impending siege of Lisbon. Among them were many "Franks" from France, England, Flanders and German states, who were afterwards induced to settle in Portugal. Aided by these powerful allies, Afonso captured Lisbon on October 24, 1147.Ribeiro 2004a, p. 70.
This was the greatest military achievement of his reign. The Moorish garrisons of Palmela, Sintra and Almada soon capitulated, and in 1158 Alcácer do Sal, one of the chief centres of Moorish commerce, was taken by storm.Ribeiro 2004a, p. 71. At this time, however, the Almohad Caliphate had triumphed in Africa and invaded the Iberian Peninsula, where they were able to check the Portuguese reconquest, although isolated bands of crusading adventurers succeeded in establishing themselves in various cities of Alentejo. The most famous of these free-lancers was Gerald the Fearless, who captured Évora in 1165.Ribeiro 2004a, p. 75.
In 1171 Afonso concluded a seven years truce with the Moors; weakened by his wound and by old age, he could no longer take the field, and when the war broke out afresh he delegated the chief command to his son Sancho. Between 1179 and 1184 the Moors retrieved many of their losses in Alentejo, but were unable to retake Santarém and Lisbon. In 1179, by the papal bull Manifestis Probatum, Pope Alexander III acknowledged Portugal as an independent nation and Afonso and his heirs as her rightful kings.Ribeiro 2004a, p. 77. Afonso died on December 6, 1185. He had secured for Portugal both the status and the name of an independent kingdom, and had extended its frontier southwards from the Mondego to the Tagus. He had laid the foundation of its navy and had strengthened, if he did not inaugurate, that system of co-operation between the Crown and the military orders which afterwards proved of incalculable service in the maritime and colonial development of the nation.
Sancho I continued the war against the Moors with varying fortune. In 1189 he won Silves, then the capital of Algarve; in 1192 he lost not only Algarve but the greater part of Alentejo, including Alcácer do Sal, to the Almohads. A peace was then arranged.
For the next eight years, Sancho was engaged in hostilities against Alfonso IX of León. The motives and course of this indecisive struggle are obscure. It ended in 1201, and the last decade of Sancho's reign was a period of peaceful reform which earned for the king his popular name of o Povoador, "the Populator".