In 666 (though dates vary from 664–666), Yeon Gaesomun died of a natural cause and a civil war ensued among his three sons. His eldest son and immediate successor, Yeon Namsaeng, defected to Tang and provided the secrets and weaknesses of Goguryeo to Emperor Gaozong, and played a critical role in the next invasion and downfall of Goguryeo. Yeon Gaesomun's second son, Yeon Namgeon, resisted in the face of death, as opposed to his brother's treachery, and fought until the very end. Meanwhile, Yeon Gaesomun's younger brother, Yeon Jeongto, defected to the Silla side.