Ali Hassan Mwinyi, a schoolteacher turned politician who led Tanzania as its second post-independence president and helped dismantle the doctrinaire socialism of his predecessor, Julius K. Nyerere, died on Thursday in Dar es Salaam, the country’s former capital. He was 98.
Tanzania’s current president, Samia Suluhu Hassan, announced the death, in a hospital, on X, formerly known as Twitter. She said Mr. Mwinyi had been treated for lung cancer.
Mr. Mwinyi was 60 when he took over the presidency in 1985 as the handpicked successor of Mr. Nyerere, who had volunteered to step down after governing his country since its beginnings of independent nationhood as Tanganyika in 1961 and its merger with Zanzibar in 1964 to create the state of Tanzania.
At the time, the peaceful transition was seen as precedent setting in a continent that had gained notoriety for political violence as the prime agent of change or succession.
But critics said Mr. Mwinyi — who went on to serve two five-year terms before stepping down in 1995 — had little of the charisma and international stature of Mr. Nyerere, an African statesman closely involved in struggles among independent nations to end Portuguese and British colonial influence in Mozambique, Angola and Zimbabwe, and to sponsor the foes of apartheid in white-ruled South Africa.
Among Tanzanians, Mr. Nyerere was known as Mwalimu — Kiswahili for teacher. Mr. Mwinyi, by contrast, was nicknamed Mzee wa Rukhsa, loosely translated as an elder who permits almost everything.
At the same time, though, Mr. Nyerere’s socialist rule — built on notions of rural collectivization, nationalization of industries and bureaucratic centralism — had led to economic failure, including shortages of foreign exchange and essential goods, ballooning debt, and dependence on foreign aid, much of it from Scandinavian countries. Tanzania had also fought a ruinous war with neighboring Uganda that toppled the dictator Idi Amin but deepened its own economic decline.
Diplomats described Mr. Mwinyi as a shy compromise candidate, in thrall to a predecessor who refused to give up the powerful post of party chairman at the same time that he handed over the presidency. Indeed, Mr. Nyerere told his successor that, having governed for 24 years, he would continue to “whisper in his ear” to pass on the wisdom that had accrued to him.
Only in 1990 did Mr. Mwinyi become the leader of Chama Cha Mapinduzi, the governing institution in his one-party state. In 1992, he oversaw a special congress that endorsed constitutional changes creating a multiparty political system.
Despite that formal change, Chama Cha Mapinduzi — the Revolutionary Party — remained the dominant political force for decades, and the presidency was occupied by a string of party figures, from Mr. Mwinyi’s successor, Benjamin Mkapa, to the incumbent, Ms. Hassan. Indeed, Mr. Mwinyi himself seemed to be no stranger to dynastic politics: One of his sons, Hussein Ali Mwinyi, became president of Zanzibar in 2020, also representing Chama Cha Mapinduzi.
During his tenure, the elder Mr. Mwinyi was credited with landmark reforms, including permitting the sale of mobile telephones, computers and television sets. He pushed for higher prices for crops grown by peasant farmers and a greater role for private businesses.
In 1986, on the brink of his country’s economic collapse, he signed an agreement with the International Monetary Fund to secure a standby loan of $78 million. It was Tanzania’s first such agreement since a previous deal collapsed six years earlier. Several more agreements followed with the fund and the World Bank.
Mr. Mwinyi’s decade in power straddled the events that led to the end of the Cold War — a contest that had rippled through Africa as the opposing camps jostled for influence in states aligned with distant sponsors in Moscow and the West. When single-party rule was formally dismantled in 1992, Mr. Mwinyi declared that the switch to multiparty democracy mirrored similar global developments.
Like other African leaders of his era, he criticized American foreign policy in Africa, saying that the reluctance of the Reagan administration to endorse broader sanctions against white-ruled South Africa had created a stumbling block in the effort to dismantle apartheid.
For all that, his two terms in office were long associated with a worsening of his country’s reputation for corruption, including scams to defraud a government debt agency and to distribute food that had been found unfit for human consumption.
In the Mwinyi era, according to a scholarly paper in the African Journal of Political Science in 2002, “corruption spiraled out of control.”
Ali Hassan Mwinyi was born on May 8, 1925, in Dar es Salaam, Tanzania’s commercial center and main port, the son of Hassan and Asha Sheikh Mwinyi. His parents both came from Zanzibar, where he spent much of his childhood, according to the Tanzanian Foreign Ministry.
He earned qualifications as a teacher in Britain and taught at schools in Zanzibar before joining the government there as a permanent secretary in the Education Ministry. He went on to hold a series of government posts, and from 1972 to 1974 he represented Tanzania as its ambassador to Egypt, where he studied Arabic.
In 1960, he married Siti Mwinyi. One of their many children, Abdullah Mwinyi, a lawyer, credited his mother with supporting the family while his father was jobless after his term as ambassador in Cairo.
“For a period of approximately two years our father was out of work,” Abdullah Mwinyi wrote in a 2020 article. “Soon the ambassadorial savings would run out. At the time, there were limited opportunities in trading or any meaningful employment outside of government.”
He added, “Our mother decided to make ice lollies (we had freezers from Egypt) and cook maandazis” — a kind of fried, doughnutlike bun — “for sale and upkeep. Our mother through this venture was the breadwinner.”
Information on Mr. Mwinyi’s survivors was not immediately available.
Mr. Mwinyi became president of Zanzibar in 1984, before Mr. Nyerere chose him as his successor the next year. He left office in 1995 after serving the maximum two terms as mandated by Tanzania’s Constitution after Mr. Nyerere’s 24 years of near-absolute power. (Tanzania has held regular multiparty elections since its transition from a one-party state in the early 1990s.)
As a private citizen, Mr. Mwinyi lived without ostentation and was photographed traveling by public transport.
In 2021, Mr. Mwinyi published a memoir in Kiswahili whose title translated as “Mister Permission: The Journey of My Life.”
According to a review of the book published in The East African, a weekly newsmagazine, he said his prime legacy lay in economic reforms that broke with the Nyerere era — a task, he said, that “was not easy at all, but change was a must.”
Abdi Latif Dahir contributed reporting.