Portugal traces its national origin to 24 June 1128, the date of the Battle of São Mamede. Afonso proclaimed himself Prince of Portugal after this battle and in 1139, he assumed the title King of Portugal. In 1143, the Kingdom of León recognised him as King of Portugal by the Treaty of Zamora. In 1179, the papal bull Manifestis Probatum of Pope Alexander III officially recognised Afonso I as king. After the Battle of São Mamede, the first capital of Portugal was Guimarães, from which the first king ruled. Later, when Portugal was already officially independent, he ruled from Coimbra.
