In many ways, his victory is the latest and perhaps final clash in a battle for power and influence that has lasted decades between Mr. Khamenei and Ali Akbar Hashemi Rafsanjani, the former president who, while loyal to the Islamic form of government, wanted a more pragmatic approach to the economy, international relations and social conditions at home. Mr. Rafsanjani aligned himself and his family closely with the main reform candidate in this race, Mir Hussein Moussavi, a former prime minister who advocated greater freedom — in particular, greater freedom for women — and a more conciliatory face to the West. Another former president and pragmatist, Mohammed Khatami, had also thrown in heavily with Mr. Moussavi.