Nairobi is a completely modern creation, and everything here has been built since the city was founded in 1899. As the tracks of the East African Railway were laid down between Mombasa and Kampala, a depot was established at a small stream known to the Maasai as uaso nairobi (cold water). The Maasai were quickly forced from the land, as the British East Africa protectorate had ambitious plans to open up the interior to white colonial settlement.
In addition to its strategic position between the coast and British holdings in Uganda, Nairobi benefited from its hospitable environment – water was abundant and the high elevation enjoyed cooler temperatures than the coast. Although Nairobi was blighted by frequent fires and an outbreak of the plague, by 1907 the booming commercial centre had replaced Mombasa as the capital of British East Africa.
Quite early on, the colonial government built some grand hotels to accommodate the first tourists to Kenya – big-game hunters, lured by the attraction of shooting the country’s almost naively tame wildlife. In 1946 Nairobi National Park was established as the first national park in East Africa.
After Kenya achieved independence in 1963, Nairobi grew too rapidly, putting a great deal of pressure on the city’s infrastructure. Enormous shanty towns of tin-roofed settlements appeared on the outskirts of the capital. In the name of modernisation, almost all of the colonial-era buildings were replaced by concrete office buildings, which today characterise much of the modern city.
As Kenya's (and East Africa's) largest city, Nairobi continues to face enormous challenges. Terrorist attacks on the US embassy in 1998 killed more than 200 people, while in December 2007 the city's shanty towns were set ablaze as riots broke out following the disputed presidential election. In the early years of Kenya's involvement in Somalia, which began in 2011, Somali Islamist group Al-Shabaab claimed responsibility for a spate of bombings on transport around Nairobi's Eastleigh suburb, as well as for the devastating attack on the exclusive Westgate Shopping Mall on 21 September 2013; 67 people died in the latter assault.
In the years since the Westgate attack, security has tightened considerably in Nairobi, although whenever there's a flashpoint in the political life of the nation, it's in Nairobi where it's often felt most keenly. In the immediate aftermath of the 2017 elections, for example, violence erupted in the shanty town of Mathare and elsewhere, where migrants from other parts of Kenya now live; some of these areas are considered to be opposition strongholds. Large-scale and sustained political violence, however, has not been seen in the capital since 2007.