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 continued their mismanagement of Portugal. Portugal joined the European Community in 1986, and with the large infusion of capital to bring the country above 3rd country status, prosperity and double digit economic growth in the late 80's and early 90's was achieved along with near zero employment rate. Joining the EC gave the country a boost, with a flurry of grants and investments that contributed to new roads and an overall upgrade of a dilapidated infrastructure. However it is estimated that only 36% of the funds contributed to this growth with 64% of the grants wasted in mismanagement and corruption.