Following this, Madali Khan, who had received Conolly in Kokand, and who had also sought an alliance with Russia, lost the trust of Nasrullah. The Emir, encouraged by the conspiratorial efforts of several influential figures in Kokand (including the commander in chief of its army), invaded the Khanate in 1842. Shortly thereafter he executed Madali Khan, his brother, and Omar Khan's widow, the famed poet Nodira. Madali Khan’s cousin, Shir Ali, was installed as the Khan of Kokand in June 1842. Over the next two decades, the khanate was weakened by a bitter civil war, which was further exacerbated by Bukharan and Russian incursions. Shir Ali’s son, Khudayar Khan, ruled from 1844 to 1858, from 1862 to 1863, and from 1865 to 1875. In the meantime, Russia was continuing its advance; on 29 June 1865 Tashkent was taken by the Russian troops of General Chernyayev; the loss of Khujand followed in 1867.