The Visigoths invaded the Iberian Peninsula and were eventually assimilated by the Roman culture. In about 700 A.D., the Moors invaded the Peninsula from North Africa and conquered all but the Asturias area. In 800 A.D., Count Vimara Peres, a vassal of the King of Leon (which had taken the Northern area of the Peninsula from the Moors), regained control of the area known today as Minho from the Moors. The area was named Portucale (Portugal) after the important trading city of Portus Cale which is today’s Porto (Oporto) city. Portus Cale (Porto) is located on the estuary of the Douro river. Count Peres founded the town of Vimaranes after his name, and today Vimaranes (Guimaraes) is considered the cradle city of Portugal. Portucale (Portugal) was an autonomous county of the Kingdom of Leon. In 1070, due to its desire to become independent, it lost its autonomy ending the rule of the House of Vimara Peres.
In 1093 A.D., Henry of Burgundy was count of Portugal. Henry helped King Alfonso VI of Castile conquer Galicia from the Moors. As a reward, he was given the hand of Teresa de Leon. Thus Henry became Count of Portugal, a fiefdom of the Kingdom of Leon. Henry and Teresa had several sons, but the only one to survive childhood was Afonso Henriques. When Henry died, Afonso Henriques (also known as Afonso I) set out to take control of the county.
In 1116, Teresa de Leon, in an effort to increase the county’s land and become independent from Leon, fought her half-sister, Queen Urraca of Castile and Leon. Teresa was the illegitimate daughter of Alfonso VI of Castile, while Urraca was his legitimate daughter. Teresa lost the battle but was set free under the promise that she would run the county of Portugal under the rule of Leon.
Afonso I did not like the Count of Trave, a Galician, and considered his mother to be under his influence. Afonso I, with the help of the Archbishop of Braga and other nobles, decided to take the kingdom away from Teresa. June 24, 1128 in the battle of Sao Mamede, Afonso Henriques defeated the forces led by his mother and her lover Fernado Peres, count of Trave, who was, at the time, the regent of the county of Portugal. Teresa died in prison in 1130.
In October 5, 1143 Portugal was officially recognized as a country, and the first king of Portugal was Dom Afonso Henriques (Afonso I).