 British Somaliland became independent on 26 June 1960 as the State of Somaliland , and the Trust Territory of Somalia ( the former Italian Somaliland ) followed suit five days later . On 1 July 1960 , the two territories united to form the Somali Republic , with Mogadishu serving as the nation 's capital . A government was formed by Abdullahi <unk> and other members of the <unk> and protectorate governments , with <unk> Bashir <unk> Yusuf as President of the Somali National Assembly , Aden <unk> <unk> <unk> as President of the Somali Republic , and Abdirashid Ali Shermarke as Prime Minister ( later to become President from 1967 to 1969 ) . On 20 July 1961 and through a popular referendum , the people of Somalia ratified a new constitution , which was first drafted in 1960 . In 1967 , Muhammad <unk> Ibrahim <unk> became Prime Minister , a position to which he was appointed by Shermarke . 
