In 1824, Herat became independent for several years when the Afghan Empire was split between the Durranis and Barakzais. The Persians sieged the city in 1837, but the British assisted the Afghans in repelling them. In 1856, the Persians launched another invasion, and briefly managed to recapture the city; it led directly to the Anglo-Persian War. In 1857 hostilities between the Persians and the British ended after the Treaty of Paris was signed, and the Persian troops withdrew from Herat. Afghanistan reconquered Herat in 1863 under Dost Muhammad Khan, two weeks before his death.