The history of Portugal dates back to the Early Middle Ages. In the 15th and 16th centuries, Portugal ascended to the status of a world power during Europe's "Age of Discovery" as it built up a vast empire, including possessions in South America, Africa, Asia, and Oceania. Over the following two centuries, Portugal kept most of its colonies, but gradually lost much of its wealth and status as the Dutch, English, and French took an increasing share of the spice and slave trades by surrounding or conquering the widely scattered Portuguese trading posts and territories.
Signs of military decline began with two disastrous battles: the Battle of Alccer Quibir in Morocco in 1578 and Spain's abortive attempt to conquer England in 1588 by means of the Spanish Armada Portugal was then in a dynastic union with Spain and contributed ships to the Spanish invasion fleet. The country was further weakened by the destruction of much of its capital city in an earthquake in 1755, occupation during the Napoleonic Wars and the loss of its largest colony, Brazil, in 1822. From the middle of the 19th century to the late 1950s, nearly two million Portuguese left Portugal to live in Brazil and the United States.
In 1910, there was a revolution that deposed the monarchy. Amid corruption, repression of the church, and the near bankruptcy of the state, a military coup in 1926 installed a dictatorship that remained until another coup in 1974. The new government instituted sweeping democratic reforms and granted independence to all of Portugal's African colonies in 1975.
Portugal is a founding member of the North Atlantic Treaty Organization (NATO), the Organisation for Economic Co-operation and Development (OECD), and the European Free Trade Association (EFTA). It entered the European Economic Community (now the European Union) in 1986.