Sino-Sikh War

In the 18th to 19th centuries, the Sikh Confederacy of the Punjab region in India was expanding into neighbouring lands. It had annexed Ladakh into the state of Jammu in 1834. In 1841, they invaded Tibet with an army and overran parts of western Tibet.

Chinese forces defeated the Sikh army in December 1841, forcing the Sikh army to withdraw from Tibet, and in turn entered Ladakh and besieged Leh, where they were in turn defeated by the Sikh Army.

At this point, neither side wished to continue the conflict, as the Sikhs were embroiled in tensions with the British that would lead up to the First Anglo-Sikh War

while the Chinese was in the midst of the First Opium War with the British East India Company

The Chinese and the Sikhs signed a treaty in September 1842, which stipulated no transgressions or interference in the other country's frontiers

The McMahon Line is clearly shown as India’s boundary in the east. But for the entire western sector, right from the Sino-Indo-Afghan trijunction to the Sino-Indo-Nepalese trijunction, the legend reads: ‘Boundary Undefined’.

File:Sikh Empire.JPG

Britain as the preeminent power wanted to encroach upon Chinese territory, and every few years expanded the definition of “India”. First they took over Leh and Ladakh, then they defined the McMohan Line. But that did not satiate their appetite. They then took over Aksai Chin–but never exercised control over it—the Chinese a weak and weakened power were powerless to halt the march of the British..
The British defeated the Sikhs in 1846 and took over sovereignty over Ladakh. The British commissioners and the Chinese officials were apparently sufficiently satisfied that a traditional border was recognized and defined by natural delements, and the border was not demarcated. The boundaries at the two extremities, Pangong Lake and Karakoram Pass, were well-defined, but the Aksai Chin area in between lay undefined.

The Second Opium War from 1856 to 1860 and China lost it too forcing China to import Opium into China. At the same time other stuff was happening on the Western front

W. H. Johnson, a civil servant with the Survey of India proposed the “Johnson Line” in 1865, which put Aksai Chin in Kashmir. This was the time of the Dungan revolt, when China did not control Turkestan, so this line was never presented to the Chinese. Johnson presented this line to the Maharaja of Kashmir, who then claimed the 18,000 square kilometres contained within,, and by some accounts territory further north as far as the Sanju Pass in the Kun Lun Mountains.

 The British government had some doubts on the validity of the Johnson Line[Calvin, James Barnard (April 1984). "The China-India Border War". Marine Corps Command and Staff College. Retrieved 2006-06-14.] and Johnson was censured

That would have been the end of it–but other events happened
In 1878 the Chinese had reconquered Turkestan, and by 1890 they already had Shahidulla before the issue was decided(Mohan Guruswamy, Mohan,. By 1892, China had erected boundary markets at Karakoram Pass (Calvin, James Barnard (April 1984). “

By 1865 Yakub Beg, the Commander-in-Chief of the army of Kokand too advantage of the Hui uprising in Xinjiang Province, and captured Kashgar and Yarkand from the Chinese and gradually took control of most of the region of Eastern Turkestan, including Khotan, Aksu, Kucha, and other cities in 1867. After Begs death his state of Kashgaria rapidly fell apart, and Kashgar was reconquered by the Qing Dynasty.