The First Anglo-Afghan War began in early 1839 when the British undertook an invasion of Afghanistan from India with the aim of overthrowing the Afghan ruler, Amir Dost Mohammad Khan, and replacing him with the supposedly pro-British former ruler, Shah Shujaʻ. The British were at first successful. They installed Shah Shujaʻ as ruler in Jalalabad and forced Dost Mohammad to flee the country. But in 1841 Dost Mohammad returned to Afghanistan to lead an uprising against the invaders and Shah Shujaʻ. In one of the most disastrous defeats in British military history, in January 1842 an Anglo-Indian force of 4,500 men and thousands of followers was routed by Afghan tribesmen. The British then sent a larger force from India to exact retribution and to recover hostages, before finally withdrawing in October 1842. History of the War in Afghanistan is a two-volume study of the war, based on unpublished letters and journals by British political and military officers who served in the conflict. The author, Sir John William Kaye (1814-76), was a onetime officer in the army of the East India Company who resigned in 1841 to devote himself full time to the writing of military history. The book begins with a detailed analysis of the events of 1800-1837 that led up to the war and of the "Great Game of Central Asia"--the rivalry between Russia and Britain for influence in the region that spurred British intervention in Afghanistan. This is followed by detailed accounts of the major battles and military campaigns. Kaye joins other authors in concluding that the war was a disaster for Britain: "No failure so total and overwhelming as this is recorded in the page of history. No lesson so grand and impressive is to be found in all the annals of the world." Kaye also wrote a novel based on the war, Long Engagements: a Tale of the Affghan Rebellion (1846), and several other major historical works, including The Life and Correspondence of Major-General Sir John Malcolm (1856) and the three-volume The History of the Sepoy War in India, 1857-8, published in 1864-76.