After the collapse of the Transcaucasian Democratic Federative Republic, Azerbaijan Democratic Republic declared its independence on 28 May 1918. At the time, Bolshevik Baku Commune was in control of Baku until the Battle of Baku where Azerbaijan captured the city and relocated its capital from Ganja to Baku. The uyezd was kept as part of the country's administrative units.