In 1839 the British deposed the emir of Afghanistan, Dost Muhammad, and replaced him with someone more friendly to the British. However, fierce Afghanistan opposition and difficult weather conditions finally forced the British to evacuate. On January 6, 1842 a retreating force of troops and civilians were annihilated as they left Kabul. On September 14 a British army retaliating for the January 6 action defeated Afghan forces and re-occupied Kabul. In October the British army left Afghanistan and Dost Muhammad was restored.