Settlements in the Taiyuan region date back to Neolithic times. The town,then known as Jinyang,was founded some 2 400 years ago. Its location in a valley near the Fen River put it near the invasion routes from the nomadic regions in the north. The city suffered from frequent occupation by invaders,including the Xiongnu in Han times and the Toba Turkic rulers of the Northern Wei in the 4th-6th centuries. The founder of the Tang dynasty,Li Yuan,used Taiyuan as a base for the peasant uprising that overthrew the Sui regime in the early 7th century. Jinyang was destroyed in 979 by Song dynasty forces,but rebuilt three years later and renamed Songcheng. Starting in 1375 in the early Ming dynasty the town became the seat of government for Taiyuan region and expanded greatly.
English,French,and Russian communities exploited the region's mineral resources in the 19th century. Taiyuan was one of the centers of the nationalistic Boxer Rebellion around 1900,when all the foreign missionaries and their families were put to death on the order of the provincial governor. After the end of the Qing imperial system in 1911,Taiyuan was governed by a regional warlord named Yan Xishan between 1912 and 1949. Operating under the Kuomintang but largely an independent and arbitary ruler, he suppressed opium smoking and foot-binding,among other reforms,but allowed development of coal resources by the Japanese in the early 1940's.