He also held a variety of posts relating to national security; during the Iran-Iraq War (1980–88) he served as a member of the High Council for National Defense and as the commander of Iran’s air defenses, and in 1989 he was appointed secretary of the Supreme National Security Council, a position that he occupied under Presidents Hashemi Rafsanjani (1989–97) and Mohammad Khatami (1997–2005). While serving in government, Rouhani continued his academic work, earning a Ph.D. from Glasgow Caledonian University in 1999 with a dissertation on Islamic law.