In Iran, the First World War (1914-1918) was preceded by the Constitutional Revolution (1906-1911) with the goal to open up the country to more freedom and Westernizing reforms such as secular education for all including girls and freedom of media and political parties.
At that time, the Qajar dynasty (1794-1925) was in power. The Qajar Shahs were first reluctant to accept to transform the government from an absolute monarchy to a constitutional one, and later forcefully opposed it. The government finally agreed in 1906 with a constitutional form of monarchy.
Iran's government was extremely weak and split between pro-Russian and pro-British forces. German and Turkish agents were also active in Iran.
As Great Powers, Russia and Great Britain were in a bitter rivalry that ended in a secret agreement in 1907 to divide Iran into three sections: a northern Russian part, a southern Britisch zone and a 'neutral' section. Once the news about the secret agreement became public, the revolution targeted it and rapidly added a strong anti-imperialist character to its progressive and Western-style goals.
When the First World War broke out in 1914. Iran immediately declared its 'strict neutrality.'
The Russians occupied Iranian Azerbaijan and the country's other northern provinces and Britain did the same in the southern part of Iran. This provoked the Ottoman Empire to send forces into Iranian Azerbaijan with the pretext of 'protecting co-ethnic Turks of Iran. Trying to secure its eastern backyard, Constantinople also occupied Muslim parts of the Caucasus (today's Republic of Azerbaijan). The effort of using the 'ethnic card' backfired in Iran, drawing Iranians and especially Iranian Azeris more forcefully against both Russian and Ottoman intervention and in favor of a united and strong Iran.
The conflict between the Allies and Central Powers on Iran's territory didn't come without consequences for the population. Russian blockades of grain transfers from the northeastern Khorasan province, large scale requisitions of grain and animals in the south by the British, led to a disruption of food supplies. This combined with a severe drought in 1916 and 1917 resulted in a famine in the country.
In 1918 the famine spread to the entire country, made worse by hoarders of grain. People started looting bakeries in major cities in Iran. According to Steven, R. Ward a former CIA analyst, around 2 million Iranians died in this famine and the subsequent outbreak of epidemics in the country.
After the October Revolution, Russian troops withdrew from Iran as well as the Ottomans, who defeated in the four-year conflict. Iran was able to survive the Great War without sacrificing its territorial integrity. The public mood increasingly favored a united, Western-style Iran with a secular and centralized government. In 1925 the Iranian constituent assembly deposed the Qajar dynasty and appointed the secular Reza Shah Pahlavi, who was a secularist, as the new, legal monarch.