Since the early 18th century the Kazakh and Dzungar relations deteriorated sharply because of Dzungar invasions. These events undermined foundations of the state, which was consolidated by the policy of Kasym, Khak Nazar, Esim and Tauke. After the death of Tauke Khan a whole series of misfortunes for the Kazakhs started. Among them defeats of the Kazakh troops in 1717 - 1718, death of Kaiyp Khan and Bulat Khan's death during the “Great calamity” in 1723 - 25. Only by the end of the 20’s of the 17th century, in face of common danger the Kazakhs joined together (A.I.Levshin) and began to fight back against the Dzungars.
The name “Dzungars” referred to West Mongolian tribes of the 16-17th centuries settled in the upper reaches of the Irtysh River and the foothills of the Altai Mountains. “Dzungar” means “left hand” and originally referred to one of the major tribes of the confederation – the Choros, and sometimes the Dorbets. In fact, the alliance also consisted of other tribes, such as the Torghuts and Khoshuts. The Turkic peoples of Central Asia called them "Kalmak", that means “remnant” or “to remain”. Thus, the Russian word "Kalmyk" came from the Turkic one. The Chinese sources called them "El’ut", from the name of West Mongolian Oirat tribes, or their original name Dorben Oirat, meaning “The Allied Four”.
Strengthening of the Dzungars associated with coming to power of the Choros ruler Batur. He was the first Oirat leader took the title of "Khong Tayiji." In 1640, at a place, called Ulan Urga, he assembled a council of Dorbet and Oirat rulers of the tribes, where the so-called "Steppe Code" (or Tsaadzhin bichig) was drafted. The main purpose for this entente was to form a pan-Mongol coalition against all potential external enemies, such as the Manchus and the Chinese. The Manchus at that time were conquering the Chinese lands, and actually were ready to create a new nomadic empire. Subsequently, they managed to establish the Qin Dynasty in China, which eventually destroyed the Dzhungar Khanate in 1756-1757. However, the Torghut’s participation in the entente, by that time had already moved to the banks of the Jayiq and Itil rivers (the Ural and the Volga), shows that there were other political purposes. One of such problems was the relations strategy with the neighbors, including the Kazakhs. Right after the council of the Kalmyk nobility in 1640, several military campaigns were organized over the eastern limits of the Kazakh Khanate. In 1643, Zhangir Khan hardly managed to stop the Dzungar invasion (Battle of Orbulak). But still, the overall results of this campaign were useful for the Dzungars. They captured eastern part of Semirechye. The Dzungars also raided northern Kazakh steppes. In the 30- 40’s the territory between the Irtysh River and Lake Balkhash actually was under their control. In the upper reaches of the Irtysh River there was a residence of Khong Tayiji.
The Torghut rulers at that time settled in the lower reaches of the Volga River and displaced the Nogai tribes from their lands. In the 30-40's the large Kalmyk army assaulted not only the Kazakhs, but also the Russians (in Siberia, near Astrakhan, etc.) and the Bashkirs (near Ufa).
According to historical sources, the Kalmyk troops constantly attacked Siberian Russian settlements in Tyumen and Tarsky Uyezds. At this time, in separate Kalmyk settlements (along the Irtysh, in the Karkaraly Mountains, etc.) several Lama Temples appeared. More and more Kalmyks converted to Lamaism and became estranged from the surrounding Turkic nomads. A great Khoshut prince Zaya Pandita was a Buddhist missionary priest and reformer of Kalmyk writing system.
A new wave of Dzungarian attacks on the Kazakh Khanate started after the accession of Galdan Boshugtu Khan. By the 80’s year of the 17th century the Kazakhs were driven out of Semirechye by the Dzungars, losing their towns and rich pastures. "Since the power of the Oirats in Semirechye was not disputed, and their many wars with the Kazakhs, Mongols and Chinese were not related to this area" (Bartold). In 1681- 1684 Galdan organized a major campaign to the south of Kazakhstan, and in 1684 the city of Sairam was destroyed. The Kazakhs headed by Tauke Khan with great difficulty managed to stabilize the situation on the eastern borders.
The south of Kazakhstan was especially important for the Oirats. This region had a large number of cities that became trade centers of nomadic and sedentary tribes. The cities of Taraz, Sairam, Otrar, Turkestan and others were the source of well-being for nomadic tribes of Sary-Arka. The nomads bought in these cities all the basic necessities that were needed in everyday life. Political dominance in these oases provided the rulers with the ability to collect taxes and tributes, necessary for the proper functioning of power structures.
In the 90’s of the 17th century war with China forced Galdan Boshugtu to stop aggression against the Kazakhs. But at the beginning of the 18th century Tsewang Rabtan turned his arms against the Kazakhs. In two battles in 1717 (at the Ayaguz River) and in 1718 (at the Bogen, Shayan and Arys rivers) the Kazakh army suffered a crushing defeat. The Kazakh army, led by Khans Kaiyp and Abul Khair, returned ingloriously in their uluses. We do not know what the reason for the failure was. Perhaps, disorganization of the Kazakhs caused by unexpected attack, absence of strong central government and lack of coordination in the actions of the Khans were the main reasons for their defeat.