information:filtering, stylistic:style_transfer, information:highlighting, quality:correction
Wei and Jin dynasties

On April 4, 190 AD, Chancellor Dong Zhuo ordered his soldiers to ransack, pillage, and raze the city as he retreated from the coalition set up against him by regional lords all over China. The court was subsequently moved to the more defensible western city of Chang'an (modern Xi'an). Following a period of disorder, during which warlord Cao Cao held the last Han emperor Xian in Xuchang (196–220), Luoyang was restored to prominence when his son Cao Pi, Emperor Wen of the Wei dynasty, declared it his capital in 220 AD. The Jin dynasty, successor to Wei, was also established in Luoyang. At the height of Jin rule, Luoyang had a population of 600,000 and was probably the second largest city in the world after Rome.

At the start of the 4th century, Luoyang was subjected to repeated attacks during the War of the Eight Princes and Upheaval of the Five Barbarians under the Jin. In 311 AD, rebel forces of the Xiongnu -led Han-Zhao dynasty sacked and razed the city in an event known as the Disaster of Yongjia. For the next two centuries, Luoyang would cease as a major population hub, but remained a hotly contested region among various states to come. It was the site of a pivotal battle in 328 between the Han-Zhao and Later Zhao dynasties which established the latter as a hegemonic power in the north. The city changed hands several times throughout the Sixteen Kingdoms period, as it was also controlled by the Former Yan, Former Qin and Later Qin dynasties. The Jin dynasty, which had relocated south of the Yangtze river after the upheaval, was even able to recover the city on a few occasions.