The Tibet–Ladakh–Mughal war of 1679–84 was fought between the Gelug dominated Tibetan government and the Drukpa Kagyu Ladakh.
In the late 17th century, Ladakh sided with Bhutan in its dispute with Tibet. The Tibetans decided to punish Ladakh for interfering in their relations with Bhutan and the oppression of Gelug monasteries in Ladakh.
In 1679 the 5th Dalai Lama appointed the lama of the Tashilhunpo Monastery, the Koshut Galdan Chhewang, as the commander of the Tibeto-Mongol expedition to Ladakh. Galdan Chhewang first secured his flanks when he made a treaty with Raja Kehri Singh of Bashahr, granting him trade rights with Tibet.
Galdan Chhewang's first campaign resulted in the defeat of the Ladakhi army, led by Sakya rGya-mTsho, at Khan-dMar. The next year he defeated the Ladakhis again Byan-la and occupied the country with the exception of Basgo, Ladakh's capital, which would hold out against the Tibetan attacks for the next three years.
The stalemate was broken with the Mughal Empire's intervention in the war. The Muslim Mughals had included Ladakh in their sphere of influence in 1665. In 1683 an army led by Fidai Khan, son of governor Ibrahim Khan of Kashmir, defeated the Tibeto-Mongol army and lifted the siege of Basgo, continuing the pursuit until Lake Pangong. The Kashmiris helped restore Ladakhi rule on the condition that a mosque be built in Leh and that the Ladakhi king convert to Islam. The Mughals retreated after signing a treaty with the Ladakhis.
With the help of reinforcements from Galdan Boshugtu Khan, Khan of the Zungar Empire, the Tibetans attacked again in 1684. The Tibetans were victorious and concluded a treaty with Ladakh then they retreated back to Lhasa on December of 1684.
The Treaty of Tingmosgang in 1684 settled the dispute between Tibet and Ladakh but severely restricted Ladakh's independence. The Treaty fixed the Tibetan-Ladakhi border at the Lhari stream near Demchok and regulated trade and tribute missions from Ladakh to Tibet.