Khiva was to play a crucial role in pushing the Russian empire south towards India - their ultimate goal - and experienced three Russian invasions.
The first invasion in 1717 had ended in almost complete annihilation of the Russian troops. Khiva had earlier offered to submit to Peter the Great of Russia in return for help against marauding tribes. In a belated response, a force of about 4000, led by Prince Alexandr Bekovich, arrived in Khiva in 1717. Unfortunately, the khan at the time, Shergazi Khan, had lost interest in being a vassal of the tsar. Battling against the Khan's army and running short of water, they welcomed the Khan's offer of a truce and discussion of terms. He came out to meet them, suggesting they disperse to outlying villages where they could be more comfortably accommodated. The Russian generals were suspicious but were overridden by their commander - an Azeri convert to Christianity - who understood the sanctity of hospitality and did not want to cause offence. Once divided, the Russians were promptly slaughtered - a remnant surviving and put to work with Persian slaves building the Mohammed Ghazi Khan madrassah, leaving just a handful to make their way back with the news. Shergazi Khan sent Bekovich’s head to his Central Asian rival, the Emir of Bukhara, and kept the rest of him on display.
In 1740, Khiva was wrecked by a less gullible invader, Nadir Shah of Persia, and Khorezm became for a while a northern outpost of the Persian empire. By the end of the 18th century it was rebuilt and began taking a small share in the growing trade between Russia and the Bukhara and Kokand khanates.
The perfect pretext for a second invasion was provided by the returning diplomat-cum-spy Captain Muraviev. He visited Khiva in 1820 and discovered the city's bustling slave trade, bolstered by captured Russians. Most of the slaves were Persian Shi'ites - considered worse than infidels by the Sunni Turkmen and Khivans. Turkmen raiders captured them, forcing any Christians or Jews among them, who were considered 'People of the Book', to convert to the Shi'ite faith first, making them infidels and thus worthy of slavery. Those who survived the long desert march were sold in the Khiva slave bazaar. Persian slave girls were the most popular additions to harems, while a young Russian male was considered the hardest-working and worth four camels.
Captain Muraviev narrowly avoided slavery and imprisonment himself. He held audience with the Khan and was kept for a number of months under house arrest. During his first day in Khiva, he had seen the pitiful faces of Russian slaves in the crowds as they stared imploringly at him. The slaves made contact with him secretly through a message hidden in the barrel of a gun he'd sent for repairs:
'We venture to inform your Honour that there are over 3,000 Russian slaves in this place, who have suffered unheard of misery from labour, cold, hunger etc. Have pity on our unhappy situation and reveal it to the Emperor. In gratitude we shall pray to God for your Honour's welfare.'
Later, Muraviev met one of the unfortunate slaves personally.
The old man's name was Joseph Melnikov; he had been 30 years in slavery, was the son of a soldier, and had only been married a week when he was seized by the Kirgiz near the fortress of Pretshistinsk and sold as a slave at Khiva. After 30 years of bitter bondage, when by daily and nightly work he had at length scraped together sufficient money to purchase his freedom, his master cheated him by accepting his savings, and, instead of setting him at liberty, selling him to someone else. (Captain Frederick Burnaby, A Ride to Khiva, 1876)
The Russians had found their pretext, but waited until 1840 before acting. Summoning a vast army, they planned to attack Khiva in winter, fearing the scorching desert summers. Unfortunately they chose the coldest winter for decades and soon their army was decimated by scurvy, snow-blindness, hypothermia and wolves. Eventually they turned back, suffering massive casualties without even a glimpse of the walled city.
It was clear that the Russians would not admit defeat, and the English stationed in Persia dispatched Captain Abbot to Khiva, hoping he could persuade Allah Kuli Khan to release the Russian slaves (now a mere 300 or so) and destroy any pretext for another invasion. Captain Abbot - a rather dour and mournful character - failed to impress the Khan and narrowly avoided being buried up to the neck in the desert, a suggestion made by the Khan's spiritual advisor. With no news from Abbot, a dashing young officer by the name of Richmond Shakespeare was sent to Khiva. He used his charm and eloquence to convince the Khan of an imminent Russian threat - despite their recent defeat - and the need to free all Russian slaves.
Reluctantly the Khan complied, even releasing favourite slaves from his harem. The liberated Russians followed Shakespeare in a joyful exodus across the desert to Russian territory. The Tsar - privately livid - offered public gratitude to the British for this liberation, buying the Khanate of Khiva 30 more years before the Russians finally invaded successfully under General Kaufmann in 1873.
When the Russians finally sent a properly organised expedition against Khiva, it was no contest. In 1873 General Konstantin Kaufman’s 13,000-strong forces advanced on Khiva from the north, west and east. After some initial guerrilla resistance, mainly by Yomud Turkmen tribesmen, Mohammed Rakhim II Khan surrendered unconditionally. Kaufman then indulged in a massacre of the Yomud. The khan became a vassal of the tsar and his silver throne was packed off to Russia.
The enfeebled khanate of Khiva struggled on until 1920 when the Bolshevik general Mikhail Frunze installed the Khorezm People’s Republic in its place. This, like the similar republic in Bukhara, was theoretically independent of the USSR. But its leaders swung away from socialism towards Pan-Turkism, and in 1924 their republic was absorbed into the new Uzbek SSR.