Oil extraction and refining began in Azerbaijan in the 19th century, with the first oil distilling factory opening in Balakhani in 1837. In the late 1800s, Azerbaijan emerged as a global leader in oil production, building the world's largest oil pipeline between Baku and Batum from 1897-1907. However, violence erupted in Baku in 1918 as Armenians and Bolsheviks carried out pogroms against Azerbaijanis, destroying buildings and leaving an estimated 12,000 civilians dead.