In 1878, the Cape of Good Hope, then a British colony, annexed the port of Walvis Bay and the offshore Penguin Islands; these became an integral part of the new Union of South Africa at its creation in 1910. In 1884 the German Empire established rule over most of the territory, forming a colony known as German South West Africa. It developed farming and infrastructure. Between 1904 and 1908 it perpetrated a genocide against the Herero and Nama people. German rule ended in 1915 with a defeat by South African forces. In 1920, after the end of World War I, the League of Nations mandated administration of the colony to South Africa. As Mandatory power, South Africa imposed its laws, including racial classifications and rules. From 1948, with the National Party elected to power, this included South Africa applying apartheid to what was then known as South West Africa.