Successors to the Majapahit conquerors of Bali established themselves at Gelgel (just south of modern Klungkung) around 1400, with the Gelgel dynasty strengthening the growing Majapahit presence on the island. During the 17th century the successors of the Gelgel line established separate kingdoms and the dominance of the Gelgel court was lost. The court moved to Klungkung in 1710, but never regained a preeminent position.
In 1849, the rulers of Klungkung and Gianyar defeated a Dutch invasion force at Kusamba. Before the Dutch could launch a counterattack, a force from Tabanan arrived and the trader Mads Lange was able to broker a peace settlement.
The south Bali kingdoms jostled between themselves for supremacy for the next 50 years, until the raja of Gianyar petitioned the Dutch for support. When the Dutch finally invaded the south, the king of Klungkung was forced to choose between a suicidal puputan like the raja of Denpasar, an ignominious surrender such as that made by Tabanan's raja, or cutting a deal as the raja did up the road in Bangli. He chose the first option. In April 1908, as the Dutch surrounded his palace, the Dewa Agung and hundreds of his relatives and followers marched out to certain death from Dutch gunfire or the blades of their own kris (traditional daggers). The sacrifice is commemorated in the towering Puputan Monument.