After establishment of Azerbaijan Democratic Republic on May 28, 1918, he was appointed Minister of Agriculture and Labor in Fatali Khan Khoyski's newly formed government and served in the National Assembly of Azerbaijan until the Bolshevik invasion of Azerbaijan on April 28, 1920, when he fled the country.