The Hồng Bàng dynasty of the Hùng kings first established in 2879 BC is considered the first Vietnamese state in the History of Vietnam (then known as Xích Quỷ and later Văn Lang). In 257 BC, the last Hùng king was defeated by Thục Phán. He consolidated the Lạc Việt and Âu Việt tribes to form the Âu Lạc, proclaiming himself An Dương Vương. In 179 BC, a Chinese general named Zhao Tuo defeated An Dương Vương and consolidated Âu Lạc into Nanyue. However, Nanyue was itself incorporated into the empire of the Chinese Han dynasty in 111 BC after the Han–Nanyue War. For the next thousand years, what is now northern Vietnam remained mostly under Chinese rule. Early independence movements, such as those of the Trưng Sisters and Lady Triệu, were temporarily successful, though the region gained a longer period of independence as Vạn Xuân under the Anterior Lý dynasty between AD 544 and 602. By the early 10th century, Vietnam had gained autonomy, but not sovereignty, under the Khúc family.