Throughout the Middle Ages, from its conquest by the Islamic Empire in the year 641 until 1517, Egypt was governed as part of a series of Arab Caliphates. The various Caliphs, including the Umayyad and the Fatimid dynasties, kept hold of the country for almost 900 years, despite invasions by neighbouring empires and the Crusades being waged against them. During this time, Cairo was built and became capital city.
In 1517, the Mamluk Caliphate of Egypt was conquered by the Ottoman Turks, reducing it to a province forced to pay huge taxes to the Ottoman Empire. It was still semi-autonomously ruled by the Mamluks, however a weakened economy, plagues and famines made it vulnerable, and it was invaded in 1798 by Napoleonic forces.
When the French were then defeated by the British in 1801, it left a power vacuum between the Mamluks, the Ottoman Turks, and Albanian mercenaries serving the Ottoman army, paving the way for independent Egypt in 1805.
In 1805, the Albanian commander Muhammed Ali seized power and massacred the Mamluks. With temporary approval of the Ottomans, he ruled an effectively independent Sultanate and instituted many military, economic and cultural reforms. He is, as such, considered the founder of Modern Egypt.
Under the successors of Muhammed Ali, Egypt began to lose its power, and fell under the influence of the British, French and Turkish. Egypt was then occupied by the British from 1882 until 1956, and was used as a base for British operations during World War II. Under the popular King Farouk, British forces were forced to withdraw from most of the country, with the exception of the area surrounding the Suez Canal. Anti-British feelings continued, and in 1952 a military coup overthrew Farouk's monarchy, establishing the Republic of Egypt.
Since the 1952 Revolution, Egypt has remained independent, however the ensuing years have been characterised by conflict with Israel and its supporters, including the Suez Crisis, the Six-Day War in 1967 and the 1973 War.
The historic Camp David Peace Treaties signed by Egypt - under President Sadat - and Israel in 1978 saw much-improved international relations between the Republic and the rest of the world. After Sadat was assassinated by fundamentalist army officers in 1981, control was taken by President Mubarak. Mubarak's 29-year-rule was based on commitment to the Camp David Accords and had great success in domestic economic reforms. However, his presidency saw a huge amount of social unrest, political corruption and police brutality, and he was overthrown during the 2011 Egyptian Revolution.
Abdel Fattah el-Sisi has been President of Egypt since 2014.