During the Middle Ages, the Uíge Province was the heartland of the Kongo Kingdom. The Bakongo North and South of the Kongo river were all part of this Kingdom, a centralized monarchy which for given periods of time also dominated part of the Ambundu further to the South. The kings lived in the city of M'banza-Kongo which had a population of about 50,000 in the 16th century. Knowledge of metallurgy among the Bakongo was renowned; their king was even called the “Blacksmith King”. Their reign was first strengthened by the arrival Portuguese priests who lived at the king's court and taught religion as well as literacy; the interaction with the Portuguese stronghold of Luanda was rather marginal for a long time. Things changed when the Portuguese started to conquer and occupy the hinterland in the 19th century. In the beginning of the 20th century, the Kongo kingdom still existed on paper and the court in M'banza-Kongo was maintained, but had lost any effective power.