War of the Eight Princes
The Jin dynasty was severely damaged after the War of the Eight Princes from 291–306. During the reigns of Emperor Huai and Emperor Min, the country was put into grave danger with the uprising of the northern non-Han people collectively known as the Five Barbarians, when numerous nomadic tribal groups resettled in China's north and northwest who had been heavily drafted into the military then exploited the civil wars to seize power. Their armies almost destroyed the dynasty in the Disaster of Yongjia of 311, when the Five Barbarians sacked Luoyang. Chang'an met a similar fate in 316.