In 1979, Rajai left the Freedom Movement. Following the persian Revolution, he was appointed minister of education in the government of Mehdi Bazargan, and although Bazargan’s cabinet resigned on 6 November 1979, he did not resign and remained in the post until 12 August 1980 when he became prime minister.