History of Hami
During the Later Han dynasty Hami repeatedly changed hands between the Chinese and Xiongnu who both wanted to control this fertile and strategic oasis. Several times the Han set up military agricultural colonies to feed their troops and supply trade caravans. It was especially noted for its melons, raisins and wine.
“The region of Yiwu [Hami] is favourable for the five types of grain [rice, two kinds of millet, wheat and beans], mulberry trees, hemp, and grapes. Further north is Liuzhong [Lukchun]. All these places are fertile. This is why the Han have constantly struggled with the Xiongnu over Jushi [Turfan/Jimasa] and Yiwu [Hami], for the control of the Western Regions.”
The Turks gained control of this region during the late Sui dynasty. The Mongols conquered this region during the Yuan Dynasty. Later Gunashiri, a descendant of Chagatai Khan, founded his own small state called Qara Del in Kumul or Hami, which accepted Ming supremacy in the early 15th century, but was conquered by another branch of Mongols later on.
The Ming Dynasty established this region as Kumul Hami in 1404 after the Mongol kingdom Qara Del accepted its supremacy. But it was later controlled by Oirat Mongols. Since the 18th century, Kumul became the center of the Kumul Khanate, a semi-autonomous vassal state within the Qing Empire and the Republic of China as part of Xinjiang. The last ruler of the khanate was Maqsud Shah.
A traveler in 1888 gave the following description of the city:
The kingdom of Ha-mi contains a great number of villages and hamlets; but it has, properly, only one city, which is its capital, and has the same name. It is surrounded by lofty wall, which are half a league in circumference, and has two gates, one of which fronts the east, and the other the west. These gates are exceedingly beautiful, and make a fine appearance at a distance. The streets are straight, and well laid out; but the houses (which contain only a ground-floor, and which are almost all constructed of earth) make very little shew: however, as this city enjoys a serene sky, and is situated in a beautiful plain, watered by a river, and surrounded by mountains which shelter it from the north winds, it is a most agreeable and delightful residence. On whatever side one approaches it, gardens may be seen, which contain everything that a fertile and cultivated soil can produce in the mildest climates. All the surrounding fields are enchanting; but they do not extend far; for on several sides they terminate in dry plains, where a number of beautiful horses are fed, and a species of excellent sheep, which have large flat tails which sometimes weigh three hundred pounds. The country of Ha-mi appears to be very abundant in fossils and valuable minerals: the Chinese have, for a long time, procured diamonds and a great deal of gold from it; at present, it supplies them with a kind of agate, on which they set a great value.”
Source From: https://en.wikipedia.org/wiki/Hami#History