Sau hai thế kỷ cai trị, the Ly Dynasty went into decline and was succeeded by the Tran Dynasty that restored political and social order. The Dai Viet civilization continued to develop. The Tran Kings further developed the Royal Enclosure and built more palaces. The Royal Capital remained within its former limits, but the population grew. Trong 1230, the administrative units were reorganized into 61 guilds. Many foreign traders and visitors came to the capital. Trong 1274, passengers of 30 Chinese boats sought permission and were allowed to settle in Nhai Tuan Guild (present Hoe Nhai and Hang Than Streets) where they set up a number of shops and markets. Uigurian and Javanese traders and Indian monks also arrived.
The urban trading and industrial economy gave rise to a stratum of city-dwellers and their unique lifestyle. According to an account, King Tran Anh Tong (1293-1314) “sometimes went stealthily around the capital at night-time on a palanquin, with an escort of about ten guards”. In this period, the royal capital’s affairs were undertaken by Binh Bac Department. Trong 1265, this Department was called Kinh Su An Phu Su and in 1311 it was renamed Trung Do Doan.
Under the Tran Dynasty, Thang Long had to combat foreign invaders. Within 30 năm (1258-1288), Yuan-Mongolian troops three times invaded Vietnam and the capital. But all their attempts were doomed to failure.
The first time the invaders came (1258), they only found an “empty” citadel. All citizens had left their houses. Eleven days after they came, the troops of the Trần King launched an oppressive counter-attach. In the Dong Bo Dau (present Hang Than slope) battle of 29th January 1259, the invaders were crushed. The second time they came (Tháng hai 1258), they again found an “empty” capital in which they stayed for three months. After the battles at Ham Tu, Chuong Duong and Giang Khau Guilds (present Hang Buom and Nguyen Sieu Streets), the invaders were virtually defeated. The third invasion took place in February 1288. After 32 days of occupation of Thang Long, the enemy troops had to retreat to Van Kiep and then withdrew to their country. But most of them left their bodies in the Bach Dang River.