Ningxia is bounded by Shaanxi to the east, Gansu to the south and west, and Inner Mongolia Autonomous Region to the north and has an area of around 66,400 square kilometres (25,600 sq mi). This sparsely settled, mostly desert region lies partially on the Loess Plateau and in the vast plain of the Yellow River, and features the Great Wall of China along its northeastern boundary. Over the years an extensive system of canals has been built. Extensive land reclamation and irrigation projects have made increased cultivation possible.
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.
By the 11th century the Tangut people had established the Western Xia Dynasty on the outskirts of the then-Song Dynasty. Jews also lived in Ningxia, as evidenced by the fact that, after a major flood destroyed Torah scrolls in Kaifeng, a replacement was sent to the Kaifeng Jews by the Ningbo and Ningxia Jewish communities.
It then came under Mongol domination after Genghis Khan conquered Yinchuan in the early 13th century. Muslims from Central Asia also began moving into Ningxia from the west. The Muslim Dungan Revolt of the 19th century affected Ningxia.
In 1914, Ningxia was merged with the province of Gansu. However, in 1928 it was detached from Gansu and became a separate province. Between 1914 and 1928, the Xibei San Ma (literally "three Mas of the northwest") ruled the provinces of Qinghai, Ningxia and Gansu. Muslim Kuomintang General Ma Hongkui was the military governor of Ningxia and had absolute authority in the province. The Muslim conflict in Gansu, which lasted from 1927 to 1930, spilled over into Ningxia. From 1950 to 1958, a Kuomintang Islamic insurgency resulted in fighting throughout Northwest China, including Ningxia. In 1954, the Chinese government merged Ningxia with Gansu, but in 1958 Ningxia formally became an autonomous region of China. In 1969, Ningxia received a part of the Inner Mongolian Autonomous Region, but this area was returned in 1979.