Crete took part in the Greek War of Independence, but the local uprising was suppressed with the aid of Muhammad Ali of Egypt. The island remained under Egyptian control until 1840, when it was restored to full Ottoman authority. Following the Cretan Revolt (1866–1869) and especially the Pact of Halepa in 1878, the island received significant autonomy, but Ottoman violations of the autonomy statutes and Cretan aspirations for eventual union with the Kingdom of Greece led to the Cretan Revolt of 1897–1898 and the Greco-Turkish War (1897). Despite an Ottoman victory in the war, Crete became an autonomous state in 1898 because of intervention in favor of Greece by European powers and was united with Greece after the Balkan Wars.