Somaliland had long come to the attention of the British from their strategically vital base at Aden. They had occupied this Arabian port since 1839 but became familiar with the hostile coast with its slave trading and warring tribes opposite. The strategic importance of the area was to be further increased with the opening of the Suez canal in 1869. Not only did the seaborne traffic increase massively, but Aden and Somaliland could be the effective choke point if it fell into the wrong hands. The area was technically under the control of the Ottoman Empire through its vassal state of Egypt. However, in reality the Egyptians paid little attention to the Ottomans, and the Somalis paid little attention to the Egyptians. The lands were pretty anarchic and power lay in the barrel of a gun.
Egypt would find itself under British control in 1882 when the British Army defeated the Egyptian army at Tel-el-Kebir. Officially it was to be Anglo-Egyptian condominium but in reality the British were the senior parties. This meant that technically the Somaliland area came under British control although this was a paper claim only. Any claims to any of the southern Egyptian lands was put into serious doubt with the rise of the so-called Mahdi's army in and around Sudan. Islamic followers flocked to his banner. The British general Gordon was caught in Khartoum by this fanatic army. After fierce political pressure, relief forces were sent to rescue Gordon. A flying column travelled down the Nile. However, the British Indian Army also sent troops to aid in the relief. They secured much of the coastline landing mainly at the Sudanese port of Suakin.
This British military presence would help cement official claims to the area around the horn of Africa. The French had a small colony at Djibouti and the Italians had expressed interest in developing colonies in the area. To forestall these claims, the British announced a protectorate over the area. It was to be subordinated to the Aden governorship until 1905.
The land was too wild and too poor quality to yield much economically. Few cash crops could grow in such harsh conditions. It would have to be heavily subsidised.
In World War 2, the Italians used their colonies of Ethiopia and Italian Somaliland to launch an attack and capture the colony. Somaliland and Ethiopia was garrisoned by some quarter of a million Italian soldiers. British forces entered from Sudan into Eritrea. These Two Indian divisions and six air squadrons were joined by a South African division and air squadrom sweeping up from Kenya. The isolated Italians put up little fight and so the Italian Eastern Empire collapsed.
In May 1960, the British Government stated that it would be prepared to grant independence to the then protectorate of British Somaliland, with the intention that the territory would unite with the Italian-administered Trust Territory of Somalia (the former Italian Somaliland). The Legislative Council of British Somaliland passed a resolution in April 1960 requesting independence and union with the Trust Territory of Somalia, which was scheduled to gain independence on 1 July that year. The legislative councils of both territories agreed to this proposal following a joint conference in Mogadishu.
On 26 June 1960, the former British Somaliland protectorate briefly obtained independence as the State of Somaliland, with the Trust Territory of Somalia following suit five days later. Later the same week, on 1 July 1960, the two territories united as planned to form the Somali Republic.