Later in its history, the dynasty divided into two dynasties based on their own religion, the Buddhist and Shivaist dynasties. Civil war was unavoidable and the outcome was Medang Empire divided into two powerful kingdom based on region and religion. The Shivaist dynasty of Medang kingdom in Java led by Rakai Pikatan and the Buddhist dynasty of Srivijaya kingdom in Sumatra led by Balaputradewa. The hostility between them didn't end until in 1006 when the Sailendran based in Srivijaya kingdom incited rebellion by Wurawari, vassal of Medang kingdom and sacked Shivaist dynasty's capital in Watugaluh, Java. Srivijaya kingdom rose into undisputed hegemonic Empire in the era as the result. Yet the Shivaist dynasty survived and successfully reclaimed the east Java in 1019 then descended to Kahuripan kingdom led by Airlangga son of Udayana of Bali.