The First Anglo–Afghan War was fought between British India and Afghanistan from 1839 to 1842.