As a frontier zone between nomadic pastoralists and sedentary farmers, Ningxia was a frequent seat of war and incursions by non-Chinese tribes. To pacify the region, the imperial government established military colonies to reclaim land. In addition, horse pasturages were founded under the Imperial Stud to safeguard the supply of army horses, as early as the Western Han dynasty (206 BCE – 9 CE). Ningxia and its surrounding areas were incorporated into the Qin dynasty as early as the 3rd century BC. Throughout the Han dynasty and the Tang dynasty there were several large cities established in the region. The Liang Province rebellion at the end of the Han Dynasty affected Ningxia.