There are several major archaeological sites in metropolitan Hanoi indicating the prominence of this location in Vietnamese history. In 1010 AD Hanoi became the capital of a reestablished Vietnamese kingdom. After 1802 the royal capital was relocated from Hanoi to Hue and northern regional administration came under the control of a viceroy in the Citadel, located just west of what is now the Hoan Kiem sector. By the 1870s, a Chinese and Vietnamese merchant quarter occupied what is now the northern section of Hoan Kiem. At French insistence in 1874, administration of the city was split between the major area of Vietnamese control and a new French concession just to the south. In 1888 the French took control of the entire urban area and rebuilt the city. A large French quarter of government buildings, shops, and residences quickly emerged just south of the merchant quarter. The Citadel was obliterated, although the Cot Co, a masonry flag tower, remains. From the 1880s to World War II (1939-1945), Hanoi developed as a French colonial capital.
Hanoi's population has grown substantially, although not steadily, since World War II. While not badly damaged during the Japanese invasion of 1940, the city was occupied by Chinese troops at the end of the war and inundated by starving refugees. At the end of the war, in 1945, Hanoi was the center of the August Revolution, a popular uprising for independence by the Viet Minh, a coalition of Vietnamese Communists and nationalists. The Viet Minh declared the Democratic Republic of Vietnam (DRV), with Hanoi as its capital, but France did not recognize Vietnamese independence. In 1946 France began fighting the Viet Minh to regain control of Vietnam in a conflict known as the First Indochina War (1946-1954). The French regained military control over the Red River Delta in 1946. Fighting in Hanoi ended in 1947, but the Viet Minh continued to fight the French in other areas of Vietnam. The urban population may then have been only 12,000, a dramatic drop from 1943, when the population was about 120,000. Migrants and refugees soon moved into the area, however, and by 1954 metropolitan Hanoi's population had grown to more than 400,000.