Ancient Egypt has one of the longest histories of any country in the world as it used to be ruled by pharaohs. As a province of the Roman Empire, it became Christian and some Coptic Church people are there after more than a thousand years of Muslim rule. The Fatimid Caliphate ruled Egypt in the tenth through twelfth centuries. Mamlukes ruled it until 1798 when Napoleon defeated them. Muhammad Ali Pasha soon took over and started a dynasty of Khedives under the Ottoman Empire. The Empire fell apart after World War I. Egypt became an independent country in 1922 and the khedive became a king. Egypt is a member of the United Nations and the Arab League. It became a republic after the Army's revolution of 1952.