The civil war among the Lê-Trịnh and Mạc dynasties resulted in 1592, when the military of Trịnh Tùng conquered Hanoi and executed king Mạc Mậu Hợp. Survivors of the Mạc royal spouse and children fled towards the northern mountains from the province of Cao Bằng and continued to rule there until eventually 1677 when Trịnh Tạc co