Nairobi got its beginnings as a British rail depot on the Mombasa-Uganda railroad. It soon grew and in 1905 replaced Mombasa as the capital of the British East Africa Protectorate, a colony of the British Empire in the late 19th and early 20th century. People flooded into the city, and it grew from its humble beginnings to a population of 9,000 in 1920 to 80,000 in 1950. This influx of people, many of them white settlers, caused friction with the local Maasai and Kikuyu tribes.These white settlers established plantations and large agricultural farms in the area. Nairobi was officially declared a city in 1954.

    After World War II, the Kikuyu people's frustration boiled over and the Mau Mau rebellion took place. The rebellion lasted from 1952 to 1960, and was a major factor in Kenyan independence from the British, achieved in 1963. The country's first president was Jomo Kenyatta, a member of the Kikuyu who was jailed by British forces during the uprising.

    Nairobi continued to grow and today is one of the largest cities in Africa. In 1998, the American Embassy in Nairobi was bombed by Osama Bin Laden's al Qaeda terrorist organization as part of a series of attacks on American embassies in East Africa. 224 people were killed by a car bomb, and 4,000 people were wounded.