Ayatollah Ali Akbar Hashemi Rafsanjani, a former president of Iran and a founder of the Islamic republic, who navigated the opaque shoals of his country’s theocracy as one of its most enduring, wiliest and wealthiest leaders, died on Sunday in Tehran. He was 82.

His death was announced by Iranian state television.

As his career seesawed through periods of revolutionary zeal and confrontation with powerful conservative rivals, he was portrayed as a Machiavellian and often ruthless player in the power struggles among Iran’s elite factions, protected by his close association with Ayatollah Ruhollah Khomeini, the revolutionary leader who overthrew the shah in 1979.

Known as a pragmatist and centrist inclined toward economic liberalism and political authoritarianism, Mr. Rafsanjani was accused by critics of corruption in amassing his fortune and of a readiness for harsh tactics to deal with dissent at home and abroad.

Argentina has accused Mr. Rafsanjani and other senior Iranian figures of complicity in the 1994 bombing of a Jewish community center in Buenos Aires, in which 85 people died. In 1997, a German court concluded that the highest levels of Iran’s political leadership had ordered the killing five years earlier of four exiled Iranian Kurdish dissidents in Berlin. The events added weight to American assertions that Iran was a sponsor of terrorism. Mr. Rafsanjani was president from 1989 to 1997.