In the early 17th century, Mongolia was divided between many different tribes. In the West were the Oirats, and in the East the Khalkas. Starting in the 1630s the Oirats began to unify into a coherent nation, while the Khalkas remained at constant war with each other. The new Oirat nation that formed in 17th century was called The Zunghar Khanate.
The Zunghars, united under Galdan Boshogtu, attacked the Khalkhas in 1688. After their defeat, the Khalkas fled to Inner Mongolia, which belonged to the Manchurian Qing Dynasty at this time. The Qing emperor was Kangxi, often said to be China’s second-longest ruling emperor (61 years!).
The Qing had conquered China from the Ming dynasty in the mid-17th century, and were slowly taking over Mongolia. They were already quite sinicized by 1719, but still retained enough of their Manchu culture for the Mongols to willingly submit to them.
Kangxi promised to feed the starving refugees, and provided the Khalkas with military support against the Zunghars in exchange for submission.
From the Khalkas’ point of view, they were submitting to a dynasty of nomadic origin and not a Chinese dynasty. Kangxi was racially part Mongol. In fact, he had more Mongol blood than Chinese (but he was still mostly Manchu).
In 1696, Kangxi drew Galdan towards Beijing with offers of peace, then personally led a campaign into Mongolia and won. Galdan fled to the West, and died mysteriously the next year. Then Kangxi withdrew and allowed Galdan’s nephew Tsewang Rabdan to take control of the Zunghar Khanate.
After about two decades of peace, tensions over Tibet led once again to war. A pro-Qing Mongol khan, Lha-Bzang, took over Tibet and deposed the Dalai Lama in 1705. Twelve years later, the Zunghars took over Tibet, killed Lha-Bzang and sacked Lhasa. In 1720, Kangxi drove the Zunghars out of Tibet. He also used the opportunity to establish firmer control over Tibet. Two years later, Kangxi died.
The Zunghar Khanate continued to exist for several decades before their eventual self-destruction. The empire fell into civil war upon the death of Galdan Tseren in 1745. The Qing used the opportunity to take over Dzungaria and systematically exterminate the Zunghars. According to a Chinese annalist, Wei Yuan, 40% of them died from smallpox, 40% were massacred, 10% were made slaves, and 10% ran away and were assimilated by other peoples.
Russia, in the meantime, was ruled by Peter the Great from 1672 to 1725. The Zunghars constantly begged Russia for arms and military support against the Qing Empire, but the Russians were only interested in trade. Peter was too occupied with the Great Northern War (1700-1721) in Europe to seriously consider campaigning in the east.
The Russians offered to militarily support the Zunghars only if they formally submitted to Peter and became part of the Russian Empire. Tsewang apparently considered this option. The Kalmyks, another Oirat people, had migrated to Russia and submitted to the Tsar in the early 17th century. They were much better off than the Zunghars. The Kalmyks still live in Russia, whereas the Zunghars were exterminated.
[Information mostly taken from China Marches West by Peter C. Perdue.]