As dictators go, Hussain Muhammad Ershad was not an outright brute. Bangladesh, under his rule, was not a land of mass terror, imprisonment and execution. It was, rather, a country where cynicism and despair were almost palpable. Where corruption reached into every corner and a fragile body politic was shrivelled.

Ershad, who has died aged 89, dominated the country for most of the 1980s and early 90s. His only qualification for leadership was that he had been chief of staff of the Bangladesh army since 1978. At that time, Bangladesh was led by another military man, the charismatic Ziaur Rahman, who had taken over in the aftermath of the assassination, in 1975, of the nation’s founding father, Sheikh Mujibur Rahman.

In 1981, it was Zia’s turn to fall to assassins’ bullets. The unsuccessful coup was mounted by middle-ranking officers, several of whom were killed in the attempt. Once again, as after the death of Mujib, an interim emergency administration tried to hold together a country that had known little but upheaval and violence since its bloody foundation in 1971.

Lt Gen HM Ershad, then a career soldier, had at that point shown little interest in politics. Even in the febrile atmosphere following the death of his old boss Zia, Ershad hesitated to play the strong man role. But early in 1982, he mount- ed a bloodless coup, imposing army rule and installing himself as chief martial law administrator. He did so claiming, and no doubt believing, that he was protecting the constitution and making the country safe again for democracy.

Ershad did eventually give up his army role and end martial law. He also organised new parliamentary elections, and set up his own faction, the Jatiya party (JP), to contest them. Civilian politics were at the time – and continue to be – dominated by the Awami League (AL) and the Bangladesh Nationalist party (BNP), set up by the murdered leaders Mujib and Zia respectively.

In the dynastic tradition of subcontinental politics, the parties were inherited by Mujib’s daughter, Sheikh Hasina, and Zia’s widow, Khaleda Zia. The women detested each other, but they hated Ershad even more, and boycotted his election.

In the 1988 poll, the JP “won” 251 out of 300 parliamentary seats, partly because of the boycott but mostly because of blatant rigging. I was the Guardian’s correspondent in the region at the time and witnessed fraud after fraud. Casual labourers were hired to give the impression that polling was brisk and orderly. In fact, the day was marked by a combination of indifference and anger: at one Dhaka station, a returning officer announced before midday that there had been a 100% turnout, and that he was closing down for the day.

It seemed almost cruel to point out to him that all his ballot boxes were out in the street, briskly blazing where the mob had torched them. That night, some senior diplomats and foreign correspondents in Dhaka discussed the likely real turnout. The highest estimate was 2%.

With this dubious mandate, Ershad returned to his pet schemes to modernise and reorganise Bangladesh. His favourite was to devolve power to the grass roots via the so-called “upazila” system. These are administrative units in rural Bangladesh, combining local and central government functions through elected representatives and officials from national ministries.

They also each have civil and criminal courts. The upazila net- work, based on 460 former thanas, or police stations, was a genuine attempt to give the rural masses some say in their own often wretch- ed lives, but in too many cases it was dominated by local strongmen and state officials on the make.

Ershad, who lived in the grand presidential mansion and had his own golf course, always talked passionately about rooting out corruption. He also was genuinely distressed by the suffering of the poorest. In 1987, I flew with him over a vast flooded plain, visiting villages that had been inundated by monsoon-swollen rivers.

At each village the president would stride through the dev- astation, modestly trying to avoid the women trying to touch his leather boots in supplication. Behind him scuttled an aide with a satchel stuffed full of banknotes. Ershad would point to this woman and that, and each would have a small bundle of cash given to them.

We broke off the tour to have a splendid, utterly inappropriate lunch in the officers’ mess of Bogra military cantonment. As we ate, Ershad’s eyes filled with tears as we spoke of the hunger and deprivation we had seen. He did not want to ask for foreign aid, he observed curiously, “because people do not like to give to beggars”.

In 1988, to gain popularity, critics said, Ershad amended the constitution to make Islam the official religion of the formerly secular, Muslim-majority state.

He was born in Dinhata, in the Cooch Behar district of West Bengal in what was then British India, to Mokbul Hussain and Mazida Khatun. His family migrated to present-day Bangladesh, then a part of Pakistan, in 1948, after Indian independence.

Ershad attended Carmichael College, Rangpur, then the University of Dhaka, graduating in 1950. After officer training school in Kohat, Pakistan, then at the Command and Staff College in Quetta, in 1969 he was made a commanding officer in the East Bengal Regiment. However, during the war of his country’s independence from Pakistan in 1971, he was interned and repatriated to Bangladesh in 1973.

Ershad was the longest serving leader of Bangladesh in the 20th century. But the country was too turbulent to allow him to become a leader for life. The AL and the BNP united for the first and only time to mount a series of street protests and hartals – violently enforced political strikes. In December 1990 the president saw that his time was up. He resigned, making way for a succession of governments for the most part led alternately by Khaleda Zia, then Sheikh Hasina, who is now in power.

In 1991, Ershad was arrested and jailed on corruption charges. However, the JP, far from disintegrating, remained a significant electoral force. In two successive elections, Ershad contested five seats and won them all, from his prison cell. Nevertheless, his glory days were over.

Released on bail in 1997, he was then convicted again in 2000 for four months, when he was also banned from participating in elections for five years. At the time of his death, a case accusing him of backing a 1991 military coup in which one of his associates, Maj Gen Abul Manzoor, was killed, was still pending.

Ershad married Raushan in 1956. He married his second wife, Bidisha Siddique, in 2000. They divorced in 2005. He is survived by three sons and a daughter.

• Hussain Muhammad Ershad, soldier and politician, born 1 February 1930; died 14 July 2019

• Derek Brown died in 2011