Egypt, though nominally part of the Ottoman Empire, had acquired a large degree of autonomy under Muhammad Ali following the Second Egyptian-Ottoman War of 1839–41.[3] In 1882 the British occupied Egypt, effectively establishing a protectorate (formally declared only in 1914).[3][2] Egypt's traditional claim to Sudan was maintained, and following a war against Mahdist forces in 1890s, the British conquered Sudan and created Anglo-Egyptian Sudan in January 1899 as a condominium state, divided from Egypt proper along the 22nd parallel.[4][3][2] The Wadi Halfa salient was added to Sudan on 26 March 1899 in order place a rail terminus from Khartoum under Sudanese control.[2] A further agreement of 1902 created an 'administrative boundary' in the east in order to facilitate the administration of various nomadic peoples, thereby creating the Bir Tawil region (to Egypt) and the Halayib triangle (to Anglo-Egyptian Sudan).[3][2]