Portugal is a sovereign state located on the Iberian Peninsula in southwestern Europe. It is the westernmost country of mainland Europe. To the west and south it is bordered by the Atlantic Ocean and to the east and north by Spain. The Portugal–Spain border is 1,214 kilometres (754 miles) long and considered the longest uninterrupted border within the European Union. The republic also includes the Atlantic archipelagos of the Azores and Madeira, both autonomous regions with their own regional governments.
The territory of modern Portugal has been continuously settled, invaded and fought over since prehistoric times. The Pre-Celts, Celts, Carthaginians and Romans were followed by the invasions of the Visigothic and the Suebi Germanic peoples. Portugal as a country was born in the aftermath of the Christian Reconquista against the Moors who had invaded the Iberian Peninsula in 711 AD and occupied most of it ever since. Precipitated by the seminal event for its foundation, the Battle of São Mamede, where Portuguese forces led by Afonso Henriques defeated forces led by his mother Theresa of Portugal and her lover Fernão Peres de Trava, which established the nation's sovereignty against rival neighbor kingdoms. Following São Mamede, the future king styled himself Prince of Portugal. He would be proclaimed King of Portugal in the Battle of Ourique in 1139 and was recognised as such by neighbouring kingdoms in 1143.