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 on the Mạc royal spouse and children fled to the northern mountains from the province of Cao Bằng and ongoing to rule there till 1677 when Trịnh Tạc conquered this previo