France first obtained a foothold in the region in 1862. French interest centered around Djibouti, the French commercial rival to Aden. By 1896 it was organized as a colony and in 1946 it became a territory within the French Union. Membership in the French Community followed in 1958. The political status of the territory was determined by a referendum in 1967, in which the Afar population, until then the group that had the lesser voice in government, gained political ascendancy with French support. The Afars opted for a continuation of the connection with France, whereas the Somalis voted for independence and eventual union with Somalia.
France officially recognized Djibouti's independence in 1977. In the three years that followed, the Afar and Issa-Somali communities struggled to obtain control over the government. In 1979, efforts were made to unite the two ethnic groups through the formation of the People's Progress Assembly (RPP). In 1981, Hassan Gouled Aptidon, president since independence, established the RPP as the only legal political party in the country.
Despite its attempts at peacemaking, Djibouti has been adversely affected by warfare in and between neighboring Ethiopia and Somalia. Moreover, beginning in 1991, tensions between Afars and the Issa-dominated government resulted in an Afar rebellion. A reconciliation agreement was reached in 1994, but the last remaining rebel group signed a peace accord only in 2001. There also were border clashes with Eritrea during the mid-1990s. Djibouti was the base of operations for French forces during the Persian Gulf War, and the French remain a strong military and technical presence. The United States also established a military presence in the nation beginning in 2002.
In 1992 a constitution allowing for a limited multiparty state was approved by Djibouti's voters. In 1993, Gouled was reelected in the country's first multiparty elections, which were widely boycotted by the opposition. The 1999 presidential election was won by Ismail Omar Guelleh, the governing party candidate (and a nephew of Gouled). In 2003 the government sought to expel an estimated 100,000 illegal immigrants, largely Ethiopians and Somalis, from the country. The move was prompted by security and unemployment concerns. the parliamentary elections that year were swept by the governing party, leading to accusations of fraud. Guelleh was reelected in 2005, but the opposition refused to contest the election, believing that the government would rig the vote.
In June, 2008, fighting erupted briefly between Djibouti and Eritrea near the Bab el Mandeb; Djibouti had accused Eritrea of occupying Djiboutian territory there earlier in the year, and relations remained tense in subsequent months. In Jan., 2009, the UN Security Council demanded Eritrea to withdraw its forces from the disputed area, but Eritrea refused to comply; Djibouti had previously withdrawn. Under an agreement signed in June, 2010, that called for Qatar's emir to mediate between Djibouti and Eritrea, Eritrea withdrew from disputed areas it had occupied. Also in 2010, the constitution was amended to permit Guelleh to run for more than two terms, and he was reelected in Apr., 2011. The opposition, which had boycotted the 2008 legislative elections and the 2011 presidential election, fielded candidates in the 2013 legislative elections, but Guelleh's party claimed three fourths of the seats, leading to opposition charges of fraud and protests in the capital.