Shamil conquered the Western Muslim tribes, and transformed a group of small bickering villages into a united country. However, he also saw great casualties to his people, particularly in the Siege of Akhoulgo in Dagestan in 1839, where he lost around 4500 of his own people. But he continued to rule until 1859, when Emperor Alexander II of Russia offered Shamil a peaceful surrender - he would even be a guest of the imperial palace. Shamil agreed, and the Caucasian Imamate was no more. However, fighting did not immediately cease.