In the early 19th century, the British occupied the city but after establishing foreign relations they were compelled to withdraw all forces from Afghanistan. The city was occupied by the Soviets in 1979 but they too abandoned it after the 1988 Geneva Accords were signed.