Portugal emerged as a country in 1143, after a 15 year rebellion by Dom Afonso Henriques (Afonso I). Afonso Henriques defeated his mother Countess Teresa of Portugal, regent of the County (Condado) of Portugal and loyal to the Kingdom of Leon, at the battle of Sao Mamede (Batalha de Sao Mamede) near the town of Guimaraes, in June of 1128. Countess Teresa was imprisoned and exiled by her son, and died in 1130. Guimaraes is therefore known as the birthplace city of Portugal.
However, the true test of an independent nation did not happened until 1385. Joao Mestre de Avis (John of Avis), with the help of legendary supreme constable Nuno Alvares Pereira, defeated the Castilians at the epic Aljubarrota battle, where the Castilians outnumbered the Portuguese 6:1. John I (Dom Joao I) was crowned King of Portugal. John I along with his sons, Duarte (to became the king in succession), Henry The Navigator, and Afonso started the "Golden Decades" of worldwide discoveries (15th and 16th centuries).
A 1911 revolution deposed the monarchy with the assassination of King Manuel I and his son. For most of the next six decades, repressive governments ran the country. Antonio Salazar a right wing fascist ran the country with an iron fist and a austere economic plan which slowly buried Portugal deeper and deeper in its third world status within Europe. Salazar also held on to the colonies of Angola, Mozambique and Guinea, which contributed not just to the deplorable state of those countries, but also to a colonial war which killed hundreds of thousands of Portuguese men.
In 1974, a left-wing military coup installed broad democratic reforms, which had the opposite effect. Too much freedom, too quickly, placed the country in total "democratic chaos". Union bosses, corrupt politicians, and left-wing and right-wing extremists took turns plundering the country, with disastrous economic and labor plans. Starting in 1976, Portugal granted independence to all of its African colonies, and a wave of refugees were poorly assimilated into a society that does not value ethnicity to this day.
Successive governments led by communists, socialists and social-democrats took turns managing Portugal. Portugal joined the EC in 1986. Socialist Prime Minister Mario Soares tenure managed to handcuff any chances for progress by signing shameless treaties with the EU which destroyed the Portuguese Agricultural and Fishing segments to the benefit of the EU rich countries. Without those prosperity in those two basic foundations of the Portuguese commercial balance, Portugal was forced to go on an import binge in the next two decades which contributed to the demise of its present economy.
Joining the EC gave the country a temporary boost, with a flurry of grants and investments that contributed to new roads and an overall upgrade of a dilapidated infrastructure. Under the tutelage of Prime Minister Anibal Cavaco Silva, a strong adherence to policies that allowed for little or no government control over the ROI of public and private investments, the country saw billions of Euros invested in useless non-ROI producing projects and millions more lost due to government corruption and money laundering. Decades later Silva was found to be tied to questionable and conflicting investments in the banking industry with some of his close associates winning an extended holiday in the Portuguese penal system. Cavaco Silva's tenure was the beginning of an era of policies which ended up with the country functionally bankrupt, and in the hands of the IMF and the EC Central Bank. In spite of such debacle, two decades later, Anibal Cavaco Silva was presented with a gift of a two term election to President of Portugal by its people. Luckily for the people who elected him the Presidency role is no more than a symbolic function.