Mahjub was introduced to communist ideas while studying at Fuad I University in Egypt, from which he was expelled in 1948 for political activities. He became Secretary General of the Sudanese Communist Party in February 1949. He was influential in international communist forums. A number of his writings focused on the idea of finding a more Nationalist formula for Marxism in Sudan, rather than the literal application of the experience of the Soviets or the Chinese. These writings helped exacerbate the Soviet-Sino split. He also rejected subordination to the Soviet Communist Party, and in contrast to a large number of other communist parties, supported freedom of religion instead of State atheism. He was arrested by the dictatorship of Ibrahim Abboud in 1959 and his trial speech in his own defence, "By Virtue of Marxism Your Honour", was an assertive and clearly-stated political testament. and under Mahjoub’s leadership, the Communist Party played an important role in overthrowing Abboud in 1964. Mahjub opposed the 1969 coup by Jaafar Nimeiri as he saw it as incompatible with the principle of democracy, which was advocated by the party, but he could not secure the approval of a majority of secretaries of the CPC Central which was required to condemn the coup. The SCP later went on to participate in the new government.
Mahjub opposed the coup 1971 coup attempt led by Hashem al Atta on 19 July 1971. Atta was able to seize power for a period of just three days before Nimeiry regained power. Nimeiry accused the SCP of masterminding the coup due to the involvement of a number of the military officers in the communist party. Nimeiry subsequently ordered the execution of a large number of SCP party leaders. Mahjub initially refused to flee the country, despite an offer of sanctuary from the East German Embassy, stating that his basic duty was to spread awareness among the masses and the establishment of democracy in Sudan, neither of which he would be able to achieve from exile. After hiding for four days Mahjub turned himself in as an effort to stop the executions of communists. Following a trial Mahjub was sentenced to execution.
Execution
Mahjub was executed on the early hours of the morning of Wednesday 28 July 1971 by hanging at Kober prison. His death was greeted with shock by a large number of Arab and Sudanese poets. It was also a great shock to the Arab Marxist movement. After his death the Sudanese Communist Party never enjoyed the influence it had previously held.