The powerful Khans of Kalat held the fort from 1512. In 1828 the first westerner to visit Quetta described it as a mud-walled fort surrounded by 300 mud houses. Although occupied briefly by the British during the First Afghan War in 1839, it was not until 1876 that Quetta came under full British control and Robert Sandeman was made political agent in Baluchistan. By the formation of political party of Muslims (Muslim league) Balochistan paid its contribution for the freedom of Pakistan. Qazi Muhammad Essa (a sunni Hazara) was the first man introduced Muslims political party in Balochistan, this struggle persisted until 1947. Following the independence of Pakistan, Balochistan joined Pakistan and Quetta became the capital of Balochistan.