BLANTYRE, Malawi - President Bingu wa Mutharika was hailed as an economic hero and decried as an autocrat since taking office eight years ago, along the way clashing with his political mentors and foreign donors.

Doctors said last Friday that President Mutharika, 78, died April 5 in Malawi of a heart attack. His body was then flown to South Africa.

President Mutharika first won elections in 2004 in the southern African nation, which is among the world’s poorest.

During his first term, the former World Bank official persisted with a program to help farmers buy fertilizer, though Western donor nations and agencies warned against imposing subsidies in a free market. His subsidies were credited with boosting Malawi’s economy.

In more recent years, the economy has stumbled.

Antigovernment demonstrations across Malawi last year were met with an unprecedented security crackdown that resulted in at least 19 deaths.

Earlier this month, after a top civil rights body called on him to quit, he departed from a prepared speech to declare he would not call a referendum on his rule.

“This is my answer . . . I won’t answer again,’’ he said. “According to laws, I’m supposed to step down in 2014, but I want to remind you that I have an unassailable majority, so that if I want to stand for a third term or a fourth term or indeed be a life president, I can do it. Even those in opposition can vote for me.’’

In March, he paid a surprise visit to neighboring Zimbabwe, where President Robert Mugabe has been accused of using fraud and intimidation to hold onto power. President Mutharika told reporters after his visit that he came to “compare notes’’ and “share ideas with my elder brother,’’ Mugabe, who has led Zimbabwe for three decades.

Malawi’s relations with foreign donors have been strained by accusations that President Mutharika was authoritarian and responsible for human rights abuses. Last month, a US aid agency that rewards good governance suspended $350 million in assistance to Malawi.

President Mutharika expelled Britain’s high commissioner to Malawi last year, after the envoy was quoted in a newspaper expressing concern about the president’s intolerance of criticism and about deteriorating human rights. Britain then indefinitely suspended aid to Malawi, which in the end invited the envoy back.

The European Union, Germany, and Norway have also halted assistance to Malawi.

Malawi’s stance on gay rights has been an area of concern.

During President Mutharika’s second term, he pardoned a gay couple who had been sentenced to 14 years in prison under the country’s antigay laws. But President Mutharika insisted the pardon was on “humanitarian grounds only’’ and said that homosexuality was still illegal in the conservative nation.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.