The civil war concerning the Lê-Trịnh and Mạc dynasties ended in 1592, when the army of Trịnh Tùng conquered Hanoi and executed king Mạc Mậu Hợp. Survivors from the Mạc royal family members fled into the northern mountains in the province of Cao Bằng and ongoing to rule there right up until 1677 when Trịnh Tạc conquered this l