The Egyptian politician Mohammed Mahdi Akef, who has died aged 89 after suffering from cancer, did much to make the Muslim Brotherhood a major political force. For six years from 2004 he served as its murshid, or general guide, and was the first holder of the post to step down at the end of a term rather than continue until he died. He left in January 2010, and at the end of that year the wave of regime change known as the Arab spring started in Tunisia. As a result of what followed in Egypt – the toppling of Hosni Mubarak, the one-year rule of the Brotherhood-backed Mohamed Morsi, and then the military ousting of Morsi – Akef spent most of his last four years in prison.

When Akef was acclaimed as the leader of the Islamist movement at the age of 75, expectations were not high. Enmity was mounting between a secretive old guard and younger, educated reformists who felt excluded. But Akef displayed persistence, charisma and unexpected political acumen. Initially he followed the Brotherhood’s gradualist tradition of navigating a modus vivendi with the establishment. In March 2005, he conditionally backed a fifth presidential term for Mubarak, but by May he was denouncing the regime as corrupt and tyrannical, “failed and finished”.

Adroitly, he channelled popular anger at US policy in Iraq, and Israeli treatment of Palestinians. Notwithstanding their adherence to Islamic sharia law, members of the Brotherhood joined a largely secular movement, Kifaya (Enough), that organised street protests for greater freedom. In the parliamentary elections that came later that year, Akef’s candidates outstripped former secularist allies, benefiting from the democratic advances that the secularists had been pressing for, and sharply increasing their level of representation to 88 out of 454 seats.

In doing so they challenged Mubarak’s dominant National Democratic party by becoming the first opposition bloc to achieve a substantial presence since Egypt’s 1952 revolution. Characteristically jovial and engaging, Akef hailed his group’s success as “victory for Egypt”. As he put it, “People have woken up and relinquished their passivity. They lived for 50 years under the helm of despotism, so they lost faith in everything, even the ballot box. This time, it was clear that [they gave] their votes freely.”

In 2004 the US had embarked on its Greater Middle East Initiative, intended to generate secular, liberal oppositions, not an Islamist revival. Faced with reality, American officials began courting Brotherhood parliamentarians after the 2005 elections, though Akef hardly made life easy for them. “Western democracy has attacked everyone who does not share the myth of the Holocaust,” he declared that December – a remark that his office later claimed did not constitute genocide denial.

He had already lambasted Israel as a “cancer”, an “evil entity implanted in the Holy Land” by Europeans. Now he hailed anti-American insurgents in Iraq as “freedom fighters”. Ever the master of ambiguity, he promised to respect all of Egypt’s signed agreements with Israel. He stressed that Islam “dignifies Christians and Jews”, and told Copts and secularly minded Muslims that there would be no sharia state without “popular assent”.

As to policy on economics, foreign affairs, defence or welfare, little was known other than the slogan “Islam is the solution”. However, constituting an organised opposition did give the Brotherhood a platform for campaigning against police brutality, corruption and inequality.

In 2011, Mubarak was overthrown after an uprising planned by groups other than the Brotherhood. However, the movement quickly endorsed it and launched the Freedom and Justice party, which gained almost half the seats in parliamentary elections, and in 2012 saw its candidate, Morsi, win the presidential election. But by the following year, public discontent with Morsi was so great that millions took to the streets and General Abdel-Fatah al-Sisi announced a military takeover.

Soon the Brotherhood was banned as a “terrorist group” and Akef was one of the hundreds of its leaders and members, including Morsi, who were arrested. He was sentenced to life imprisonment for his alleged role in the deaths of 12 protesters who had tried to attack the Brotherhood’s headquarters in Cairo. That verdict was overturned on appeal, and at the time of his death Akef was facing a retrial. None of the security forces who killed more than 600 Brotherhood supporters on 14 August 2013 faces prosecution.

Akef was born one of 10 children in Kafr Awad al-Seneita, a village in northern Egypt, in the year that Hassan al-Banna, a charismatic schoolteacher, had founded al-Ikhwan al-Muslimin, the Muslim Brotherhood. By the start of the second world war it had become a fully fledged anti-colonial party: though Britain was no longer the ruling power, its influence remained strong, and Egypt was a wartime base for its troops. Akef joined al-Ikhwan as a teenager, and in 1950, a year after police had shot Banna dead, Akef graduated from the Higher Institute for Physical Education and became a gymnastics teacher.

He also led paramilitary attacks on British troops stationed around Suez, and went on to front the Brotherhood’s student division while studying law at Ibrahim Pasha University, now Ain Shams University, in Cairo.

Though the republican revolution of 1952 seemed like the dawn of a new age for the Brotherhood, relations quickly soured after Gamal Abdel Nasser took charge. In 1954 he arrested 4,000 Brothers after a fellow officer, a known Brotherhood supporter, was accused of trying to kill him. Akef was sentenced to death for plotting to smuggle the alleged assailant out of Egypt.

Nasser’s edict was subsequently commuted to life in prison, and in 1974 Egypt’s new president, Anwar Sadat, ordered Akef’s release, after which he was appointed to a post in the reconstruction ministry.

For several years Akef lived in Riyadh, organising Saudi-sponsored Islamic youth camps in Arab, Asian and African countries. He also set up a centre in New Jersey that encouraged local Brothers to reconstitute themselves as the publicly active Muslim American Society. “We have a religion, message, morals and principles that we want to carry to the people as God ordered us,” he said, “so why should we work in secrecy?”

From 1984 Akef directed another centre in Munich, that became a focal point for radical Muslims. In talks with German government officials, he claimed to speak for all the nation’s disparate Muslims. He then returned in 1987 to an Egypt under Mubarak and joined the Brotherhood’s central administration. That same year he was elected to represent East Cairo in parliament. Charged by a military court with directing the Brotherhood’s international organisation in 1996, he spent the next three years in jail. The Brotherhood’s many branches in other countries include its Palestinian offshoot, Hamas.

By 2000, the still banned Brotherhood no longer depended on allying with existing parties – they ran independent candidates who campaigned under the original 1928 motto: “Allah is our goal; the Prophet is our model; the Qur’an is our constitution; jihad is our means; and martyrdom in the way of Allah is our aspiration.”

Akef and his wife, Wafaa Ezzat Ibrahim Eissa, had four children. He had been transferred from jail to a hospital in Cairo, but his family’s request that he be released from custody was refused.

• Mohammed Mahdi Akef, politician, born 12 July 1928; died 22 September 2017