After the 1917 revolution, he was elected to the Baku Commune. In March, he began participation in Hummet organizations. In April, he became part of the bureau of the Muslim Social Party in Baku. He continued similar activities for the rest of the year. He was one of the 26 Baku Commissars of the Soviet Commune that was established in the city after the October Revolution. According to the grandson of Mashadi; during March Days Mashadi was responsible of Shamakhi district and he saved the large part of population from the mass killings of Dashnaks as he believed the poor village population can not be dangerous to the revolution.