After occupying the city of Merv (Mary) in 1884, Russian forces crossed the disputed Afghan border and drove Afghan troops out of the Penjdeh district in 1885. The British, already alramed because Russia had halted negotiations by the Anglo-Russian boundary commission to establish peaceably the Afghan-Russian border, began military preparations to protect the city of Herat, which was considered vital to India's protection. In a temporary settlement, Russia agreed to proceed no farther until a border was fixed, but Russian troops, in violation of their orders, waged a fierce battle at Ak-Teppe on March 30, 1885, severely defeating the Afghans. War seemed likely between Britain and Russia, but British prime minister William Gladstone (1809-98) resisted militaristic sentiment at home and managed, through negotiations, to reach an agreement on September 10, 1885, whereby Russia was granted the Penjdeh district, with Afghanistan securing the Zulfkar Pass. The rest of the border was fixed in 1887.