Hanoi is an ancient city that has a history of one millennium. The first settlers in Hanoi appeared around 3000 BC. Its precursor city, Guo Luo, was built in 200 BC. During ancient times, Hanoi belonged to China. In 111 BC, the Han Dynasty established the administration of Jiaozhi Prefecture under the command of Emperor Wu, and Hanoi became part of it. At the time of the Southern Song Dynasty, Hoa Cam was established in Hanoi with its office in Changguo County. After that, it was renamed Songping County, which was the seat of Jiaozhi Prefecture. In 621 AD, the Tang Dynasty moved Jiazhou's seat to Songping County (now Hanoi) and built a city. Later, it became the Annan Protectorate governing the area. By the late Tang Dynasty, it had become the residence of the Jinghai Army Jiedushi. In 2007, the ruins of the Tang Dynasty's Annan Protectorate were unearthed in Hanoi. In the latter part of the 9th century, Nanzhao occupied Jiaozhou for a period. Gao Pian, a minister of the Tang Dynasty, built Luocheng to resist the invasion of Nanzhao, which made Jiaozhou (Hanoi) previously called Da Luo. After Vietnam gained independence from China in the year 939, the present-day area of Hanoi had served as the capital under the Vietnamese feudal dynasties of Ly, Tran and Hou Le, and was known as the "land of thousand-year-old cultural relics."