Although nominally part of the Ottoman Empire, Yemen and the sahil  came progressively under the control of Muhammad Ali, ruler of Egypt, between 1821 and 1841. After the Egyptians withdrew from the Yemeni seaboard in 1841, Haj Ali Shermerki, a successful and ambitious Somali merchant, purchased from them executive rights over Zeila. Shermerki's governorship had an instant effect on the city, as he manoeuvred to monopolize as much of the regional trade as possible, with his sights set as far as Harar and the Ogaden. Shermerki was later succeeded as Governor of Zeila by Abu Bakr Pasha, a local Afar statesman. In 1874-75, the Egyptians obtained a firman from the Ottomans by which they secured claims over the city. At the same time, the Egyptians received British recognition of their nominal jurisdiction as far east as Cape Guardafui. In actuality, however, Egypt had little authority over the interior and their period of rule on the coast was brief, lasting only a few years . The British Somaliland protectorate was subsequently established in the late 1880s, after the ruling Somali authorities signed a series of protection treaties granting the British access to their territories on the northwestern coast. Among the Somali signatories were the Gadabuursi , Habar Awal , and Warsangali. When the Egyptian garrison in Harar was eventually evacuated in 1885, Zeila became caught up in the competition between the Tadjoura-based French and the British for control of the strategic Gulf of Aden littoral. By the end of 1885, the two powers were on the brink of armed confrontation, but opted instead to turn negotiations. They later signed a convention on 1 February 1888 defining the border between French Somaliland and British Somaliland.. How many years were Yemen and the sahil under the control of Muhammad Ali, ruler of Egypt?