At midnight on 9 October 1962 the Union Jack came down at Kololo in Kampala and Uganda’s black, yellow and red flag went up. The country that became independent that night had been assembled from rival kingdoms, torn by a religious civil war and shaped by a British bargain with one kingdom, Buganda, at the expense of the others.

Uganda is a landlocked country astride the equator. It borders South Sudan to the north, Kenya to the east, Tanzania and Rwanda to the south and the Democratic Republic of Congo (DRC) to the west. It is roughly the size of Great Britain and home to dozens of ethnic groups. Kampala, the capital, spreads across seven hills near Lake Victoria, Africa’s largest freshwater lake, whose waters Uganda shares with Kenya and Tanzania. Swahili links it with those two neighbours.

Winston Churchill, who travelled there under British rule, wrote in My African Journey that “Uganda is a fairy tale. You climb up a railway instead of a beanstalk, and at the end there is a wonderful new world.” Later in the book he added: “Uganda is the pearl.” The land runs from volcanic mountains on the eastern and western frontiers to the swamps along the Albert Nile and the forests of the central plateau. It is fertile, and coffee has become both a pillar of the farm economy and a crop prized by buyers abroad.

Early settlement and the first kingdoms

People have lived in the region for at least 50,000 years, and perhaps 100,000. The evidence is Acheulean stone tools found where the shores of Lake Victoria once lay, exposed along the Kagera River valley, chiefly around Nsonezi.

The farmers who later cleared the forest were almost certainly Bantu speakers. Over centuries they spread and organised themselves under clan chiefs. Kinship rule worked for shared labour, local disputes and worship of clan deities, but it could not govern large numbers of people. By the end of the first millennium CE larger political units were forming.

The first states may date from the thirteenth to the fifteenth centuries, under pastoral rulers remembered as the Chwezi. Legend made them supernatural, but the earthworks at Bigo and Mubende show that they were human. In the fifteenth century the Bito, a Nilotic-speaking pastoral group, displaced them, and the Chwezi seem to have moved south to found kingdoms in northwest Tanzania, Rwanda and Burundi.

Three models of statehood

Out of this contact between peoples came three kinds of state, with very different ideas of who could rule.

In Rwanda and Burundi, pastoral rulers kept themselves apart from the farming majority, the Hutu. They gave up their Nilotic language for a Bantu one but held on to an ideology of superiority and a near-monopoly of wealth and rank. That order collapsed in the Hutu revolution that began in 1959, before Rwanda’s independence, and many of the Tutsi elite fled to Uganda as refugees.

In Bunyoro the Bito took power as a royal clan, ruling herders and farmers alike, without rigid caste lines. The flaw lay in the theory that every member of the clan was royal and could claim the throne. The omukama, or king, could buy off kinsmen with district governorships, but coups and breakaways were a constant danger. Bunyoro dominated the region for centuries, with spells of expansion broken by civil war. Its decline began in the eighteenth century, when Toro split away and, more seriously, Buganda rose.

Buganda grew up on the northern shore of Lake Victoria, in swamp and hill country the pastoral rulers to the north and west did not want. As in the nearby Haya kingdom of west Tanzania, wealth there came from bananas rather than cattle, and no caste divide between farmers and herders took hold. Buganda became a refuge for those escaping Bunyoro or defeated in its power struggles. One such party, led by Prince Kimera, arrived early in the fifteenth century. The clan chiefs were already struggling to absorb newcomers, and an authority above the clans was taking shape. Kimera made himself its head, the first effective kabaka, or king.

Buganda’s answer to the succession problem was its great strength. A new king took the clan of his mother, not his father. Every clan gave wives to the kabaka, so princes belonged to many clans, and on a king’s death the clan elders chose his successor from among them. The throne, in effect a lottery open to all clans, never stayed with one clan for more than a reign.

Buganda at its height

United behind its kings, Buganda turned from defence to conquest. By the mid-nineteenth century it had doubled its territory and doubled it again, taking much of Bunyoro and becoming the leading power in the region. Chiefs named by the king ran the new lands. Armies and tax collectors moved fast along purpose-built roads, with bridges and causeways over streams and swamps. On the lake, which the Baganda called Nnalubale, a royal fleet of outrigger canoes under an admiral from the Lungfish clan could land raiders on any shore.

When Henry Morton Stanley reached the capital, he found a well-ordered town of about 40,000 people around the king’s palace on a commanding hilltop. A wall more than four kilometres round enclosed grass-roofed houses, meeting halls and stores. A royal fire burned at the entrance, to be put out only when the kabaka died. Envoys waited for audiences, chiefs came for the royal council, messengers ran errands, and young pages served the king while they trained to become chiefs. Drum signals carried messages across the kingdom.

Traders, missionaries and a religious war

Until the mid-nineteenth century the lakes region was largely closed to the outside world. It had its own trade, its own great-power rivalry between Buganda and Bunyoro, and its own inland seas. The outside world arrived first through the long-distance ivory trade.

In the late 1870s the Church Missionary Society opened a mission in Buganda, and the French Catholic White Fathers soon followed. With Muslim traders from Zanzibar already at court, three faiths competed for converts and influence. By the mid-1880s each had won large numbers of Baganda, some of them in high office. When the young kabaka Mwanga tried to halt ideas he saw as a threat to the state, armed converts deposed him in 1888. Four years of civil war followed. The Muslims won at first and declared an Islamic state but were soon defeated for good.

The Protestant and Catholic victors shared out the kingdom and ruled through a figurehead kabaka, so that imported religion had remade the traditional state. Then the arrival of rival imperialists, the German Carl Peters, a former philosophy lecturer, and the British captain Frederick Lugard, broke the Christian alliance. Protestant missionaries urged acceptance of the British flag. The French Catholics backed the Germans, in the absence of French imperialists, or argued that Buganda should stay independent.

In January 1892 Protestant and Catholic Baganda went to war. The Catholics were winning until Lugard intervened with an early machine gun, the Maxim, named after its American-born inventor Hiram Maxim. The gun settled the matter for the pro-British Protestants. The French mission was burned and its bishop fled. The scandal was resolved in Europe, where Britain paid compensation to the French mission and persuaded Germany to give up its claim.

Building the protectorate

The diplomacy behind this had started earlier. In 1888 the British government granted a charter to the Imperial British East Africa Company to operate in the region, as the European powers carved up the continent. In 1890 Germany and Britain agreed that Uganda lay in the British sphere, and the company gradually took control, turning local chiefs into puppets. In 1894 Britain declared a protectorate.

With Buganda secure and the Germans gone, the British pushed their claim over what they called the “headwaters of the Nile”. Allied with the Protestant Baganda chiefs, and using Nubian mercenaries who had once served the khedive of Egypt, they set out to conquer the rest of the country. Bunyoro had escaped Buganda’s religious wars and was united under its king, Kabarega, whose regiments carried guns. After five years of hard fighting the British occupied Bunyoro and conquered Acholi and the north, and the outline of the Uganda Protectorate took shape.

Buganda was rewarded for its loyalty and its military weight. A separate treaty gave it wide self-government within the protectorate under indirect rule. It also received half of Bunyoro’s conquered land, including the old heartland of the Nyoro kingdom and several royal tombs, which doubled Buganda from ten to twenty counties, or sazas.

The road to independence

A Legislative Council was set up in 1921, but no African sat on it until 1945. In the late 1940s Ugandans rose against colonial rule, demanding more representative government and less British control.

The question of Buganda’s place shaped the last years before independence. The London Conference of 1960 could not reconcile Buganda’s autonomy with a strong central government, and the British called elections for “responsible government” in March 1961. By then three parties were in the field. The Democratic Party (DP), led by Benedicto Kiwanuka, drew on Catholics who had long felt shut out of the Protestant establishment. Milton Obote’s Uganda People’s Congress (UPC) gathered those outside the DP who opposed Buganda’s dominance. Kabaka Yekka (KY), meaning “the king only”, was a Buganda nationalist movement.

On 1 March 1962 Uganda gained internal self-government, with Kiwanuka as prime minister. After elections in April 1962 an alliance of the UPC and KY took power, and Obote became prime minister. He led the country to independence on 9 October 1962, and Uganda joined the United Nations on 25 October.

Independence night

An eyewitness, writing years later on the blog ForGodandmyAfrica, recalled how Kampala looked in the weeks around the big day. Billboards and temporary arches carried emblems of Uganda’s many cultures alongside the colours of the new flag and coat of arms. Flags and cultural symbols hung from government offices, shops, pavements and street lamps for months on either side of the date.

On the eve of independence, the temporary stands at Kololo were packed with Ugandans, departing British officials and hundreds of guests from abroad. In the same account, at midnight Obote took the oath of office as the anthem played, the Union Jack was lowered and the new flag raised. Prince Edward, Duke of Kent, represented the Queen and presided over the transfer of power. The blog also recalls a 21-gun salute, fireworks, a ceremonial opening of parliament by the Duke and Duchess of Kent, an independence speech by Obote, celebrations through the small hours of 9 October, and a parade of floats through the city centre later that day.