As the seat of the National Parliament, it is also the legislative capital of the country. It forms part of the City of Cape Town metropolitan municipality. The city is famous for its harbour, for its natural setting in the Cape Floristic Region, as well as for such well-known landmarks as Table Mountain and Cape Point. As of 2014 it is the 10th most populous city in Africa and home to 64% of the Western Cape's population. It is one of the most multicultural cities in the world, reflecting its role as a major destination for immigrants and expatriates to South Africa. The city was named the World Design Capital for 2014 by the International Council of Societies of Industrial Design. In 2014, Cape Town was named the best place in the world to visit by both The New York Times and The Telegraph.
Located on the shore of Table Bay, Cape Town was first developed by the Dutch East India Company as a victualling (supply) station for Dutch ships sailing to East Africa, India, and the Far East. Jan van Riebeeck's arrival on 6 April 1652 established the first permanent European settlement in South Africa. Cape Town quickly outgrew its original purpose as the first European outpost at the Castle of Good Hope, becoming the economic and cultural hub of the Cape Colony. Until the Witwatersrand Gold Rush and the development of Johannesburg, Cape Town was the largest city in South Africa.
The earliest known remnants in the region were found at Peers cave in Fish Hoek and date to between 15,000 and 12,000 years ago. Little is known of the history of the region's first residents, since there is no written history from the area before it was first mentioned by Portuguese explorer Bartolomeu Dias in 1486. Vasco da Gama recorded a sighting of the Cape of Good Hope in 1497. In the late 16th century, Portuguese, French, Danish, Dutch and English ships regularly stopped over in Table Bay en route to the Indies. They traded tobacco, copper and iron with the Khoikhoi in exchange for fresh meat. In 1652, Jan van Riebeeck and other employees of the Dutch East India Company (VOC) were sent to the Cape to establish a way-station for ships travelling to the Dutch East Indies, and the Fort de Goede Hoop (later replaced by the Castle of Good Hope). The settlement grew slowly during this period, as it was hard to find adequate labour. This labour shortage prompted the authorities to import slaves from Indonesia and Madagascar. Many of these became ancestors of the first Cape Coloured communities. Under Van Riebeeck and his successors as VOC commanders and later governors at the Cape, an impressive range of useful plants were introduced to the Cape – in the process changing the natural environment forever. Some of these, including grapes, cereals, ground nuts, potatoes, apples and citrus, had an important and lasting influence on the societies and economies of the region.
During the French Revolutionary and Napoleonic wars, the Netherlands was repeatedly occupied by France, and Great Britain moved to take control of Dutch colonies. Britain captured Cape Town in 1795, but the Cape was returned to the Netherlands by treaty in 1803. British forces occupied the Cape again in 1806 following the battle of Bloubergstrand. In the Anglo-Dutch Treaty of 1814, Cape Town was permanently ceded to Britain. It became the capital of the newly formed Cape Colony, whose territory expanded very substantially through the 1800s. With expansion, came calls for greater independence from Britain, with the Cape attaining its own parliament in 1854, and a locally accountable Prime Minister in 1872. Suffrage was established according to the non-racial, but sexist Cape Qualified Franchise.
The discovery of diamonds in Griqualand West in 1867, and the Witwatersrand Gold Rush in 1886, prompted a flood of immigrants to South Africa. Conflicts between the Boer republics in the interior and the British colonial government resulted in the Second Boer War of 1899–1902, which Britain won. In 1910, Britain established the Union of South Africa, which unified the Cape Colony with the two defeated Boer Republics and the British colony of Natal. Cape Town became the legislative capital of the Union, and later of the Republic of South Africa.
In the 1948 national elections, the National Party won on a platform of apartheid (racial segregation) under the slogan of "swart gevaar". This led to the erosion and eventual abolition of the Cape's multiracial franchise, as well as to the Group Areas Act, which classified all areas according to race. Formerly multi-racial suburbs of Cape Town were either purged of unlawful residents or demolished. The most infamous example of this in Cape Town was District Six. After it was declared a whites-only region in 1965, all housing there was demolished and over 60,000 residents were forcibly removed. Many of these residents were relocated to the Cape Flats and Lavender Hill. Under apartheid, the Cape was considered a "Coloured labour preference area", to the exclusion of "Bantus", i.e. blacks.
School students from Langa, Gugulethu and Nyanga in Cape Town reacted to the news of protests against Bantu Education in Soweto in June 1976 and organised gatherings and marches which were met with resistance from the police. A number of school buildings were burnt down.
Cape Town was home to many leaders of the anti-apartheid movement. On Robben Island, a former penitentiary island from the city, many famous political prisoners were held for years. In one of the most famous moments marking the end of apartheid, Nelson Mandela made his first public speech since his imprisonment, from the balcony of Cape Town City Hall hours after being released on 11 February 1990. His speech heralded the beginning of a new era for the country, and the first democratic election, was held four years later, on 27 April 1994. Nobel Square in the Victoria & Alfred Waterfront features statues of South Africa's four Nobel Peace Prize winners: Albert Luthuli, Desmond Tutu, F. W. de Klerk and Nelson Mandela. Since 1994, the city has struggled with problems such as drugs, a surge in violent drug-related crime and more recently gang violence. At the same time, the economy has surged to unprecedented levels due to the boom in the tourism and the real estate industries. With a Gini coefficient of 0.67, Cape Town has the highest rate of equality in South Africa.