This article utilizes material from archives in Kazakhstan, Russia, Kyrgyzstan, and Uzbekistan as well as published Chinese sources to explore the opium trade between Tsarist Turkestan and Xinjiang from the early 1880s to 1917. It focuses on two different levels: the borderlands economy and society, and state policies towards illegal (or ‘grey’) markets. The main groups active in the trade were Hui/Dungan and Taranchi migrants from China, who had fled Qing territory after the repression of the great anti-Qing Muslim revolts during the 1860s and 1870s. After settling in Tsarist territory, they grew poppies and exported opium back across the border to China. This article shows how the borderland economy was influenced by the late-Qing anti-opium campaign, and especially by the First World War. During the war, the Tsarist government tried to create a state opium monopoly over the borderland economy, but this attempt was botched first by the great Central Asian revolt of 1916, and later by the 1917 revolution. Departing from the prevailing historiography on borderlands, this article shows how the international border, far from being an obstacle to the trade, was instead the main factor that made borderland opium production and trade possible. It also shows how the borderland population made a strategic use of the border-as-institution, and how local imperial administrators—in different periods and for different reasons—adapted to, fostered, or repressed this most profitable borderland economic activity.