It was Rochet d'Hericourt's exploration into Shoa (1839-42) that marked the beginning of French interest in the African shores of the Red Sea. Further exploration by Henri Lambert, French Consular Agent at Aden, and Captain Fleuriot de Langle led to a treaty of friendship and assistance between France and the sultans of Raheita, Tadjoura, and Gobaad, from whom the French purchased the anchorage of Obock (1862).
Growing French interest in the area took place against a backdrop of British activity in Egypt and the opening of the Suez Canal in 1869. In 1884-85, France expanded its protectorate to include the shores of the Gulf of Tadjoura and the Somaliland. Boundaries of the protectorate, marked out in 1897 by France and Emperor Menelik II of Ethiopia, were affirmed further by agreements with Emperor Haile Selassie I of Ethiopia in 1945 and 1954.
The administrative capital was moved from Obock to Djibouti in 1896. Djibouti, which has a good natural harbor and ready access to the Ethiopian highlands, attracted trade caravans crossing East Africa as well as Somali settlers from the south. The Franco-Ethiopian railway, linking Djibouti to the heart of Ethiopia, was begun in 1897 and reached Addis Ababa in June 1917, further facilitating the increase of trade.
During the Italian invasion and occupation of Ethiopia in the 1930s and during World War II, constant border skirmishes occurred between French and Italian forces. The area was ruled by the Vichy (French) government from the fall of France until December 1942, and fell under British blockade during that period. Free French and the Allied forces recaptured Djibouti at the end of 1942. A local battalion from Djibouti participated in the liberation of France in 1944.
On July 22, 1957, the colony was reorganized to give the people considerable self-government. On the same day, a decree applying the Overseas Reform Act (Loi Cadre) of June 23, 1956, established a territorial assembly that elected eight of its members to an executive council. Members of the executive council were responsible for one or more of the territorial services and carried the title of minister. The council advised the French-appointed governor general.
In a September 1958 constitutional referendum, French Somaliland opted to join the French community as an overseas territory. This act entitled the region to representation by one deputy and one senator in the French Parliament, and one counselor in the French Union Assembly.
The first elections to the territorial assembly were held on November 23, 1958, under a system of proportional representation. In the next assembly elections (1963), a new electoral law was enacted. Representation was abolished in exchange for a system of straight plurality vote based on lists submitted by political parties in seven designated districts. Ali Aref Bourhan, allegedly of Turkish origin, was selected to be the president of the executive council. French President Charles de Gaulle's August 1966 visit to Djibouti was marked by 2 days of public demonstrations by Somalis demanding independence. On September 21, 1966, Louis Saget, appointed governor general of the territory after the demonstrations, announced the French Government's decision to hold a referendum to determine whether the people would remain within the French Republic or become independent. In March 1967, 60% chose to continue the territory's association with France.
In July of that year, a directive from Paris formally changed the name of the region to the French Territory of Afars and Issas. The directive also reorganized the governmental structure of the territory, making the senior French representative, formerly the governor general, a high commissioner. In addition, the executive council was redesignated as the council of government, with nine members.
In 1975, the French Government began to accommodate increasingly insistent demands for independence. In June 1976, the territory's citizenship law, which favored the Afar minority, was revised to reflect more closely the weight of the Issa Somali. The electorate voted for independence in a May 1977 referendum, and the Republic of Djibouti was established on June 27, 1977. Hassan Gouled Aptidon became the country’s first president.