Since the ousting of President Hosni Mubarak in February, a political struggle has raged in Egypt along ideological, generational and class lines. The fall of the authoritarian wall, built more than half a century ago, has led to a reawakening, a revival of mass politics and social mobilisation. In this context, although initially welcomed as saviours, Egypt's military rulers have miscalculated monstrously by resisting the transition to civilian rule and tightening their grip on power. Tens of thousands of Egyptians have risen in revolt against the military council in recent days, sending a clear message about the changed mood and the psychology of the people. At the same time, after decades of being outlawed and persecuted, religious activists, or Islamists, have emerged above ground as a pivotal force, openly mobilising their old supporters, who number in the millions, and recruiting new members.

Of all the Islamist groups, the Muslim Brotherhood has the broadest base, with a membership of about half a million and a formidable political machine. Founded in 1928, the organisation did not participate actively in the protests that drove Mubarak from power, but it has mobilised its followers ever since in a newly formed political party, Freedom and Justice. Positioning itself as a voice for the poor, a huge constituency representing almost half of Egypt's 82 million people, the Brotherhood aims to win 40 per cent of the seats in par­liamentary elections scheduled to begin on 28 November. Whatever the outcome, the Brotherhood will be a dominant player in post-Mubarak Egypt and will shape the country's domestic and international relations.

The Muslim Brotherhood's chance of gaining a majority of seats in the new assembly has alarmed Egyptian liberals and minorities and secularists, who fear that the organisation will impose rigid, regressive religious laws on society. They accuse the Muslim Brothers of paying lip-service to democratic principle and of plotting to hijack the secular state and replace it with sharia-based rule.

The secular-religious divide is the most fundamental fault line in Egyptian politics, and it is one that threatens the transition from authoritarianism to pluralism. Deeply suspicious of Islamist parties' commitment to plurality, the secularists have called on Egypt's military rulers to put in place safeguards to limit the clout of their ideological rivals, in case they should triumph at the ballot box. They want guarantees that a new constitution will ensure freedoms of religion and expression.

When the Brotherhood's political and charitable machine launched Millioniyyat al-Khayr (the million-man act of goodwill) to provide 1.5 million kilograms of discounted meat to five million Egyptians for Eid ul-Adha, the Feast of Sacrifice, early this month, it was denounced as vote-buying using foreign funding. Egyptian liberals have accused Gulf states, in particular Qatar, of secretly funding Islamists to spread their brand of conservative religion to the most populous Arab state, and the region's capital of cultural production. In pitting themselves against the Islamist parties, liberals (represented by the Egyptian Bloc alliance) risk alienating a society that is deeply religious. As with their Tunisian counterparts, they will find it difficult to attract voters who do not already identify with their cosmopolitan world-view. At the centre of the current revolt against the military council - which will most likely play into the Brotherhood's electoral strategy - lies that same secular-religious divide. As Egyptians battled the police and the army this month, the Brotherhood issued a direct challenge to liberals. "Will you respect the will of the people or will you turn against it?" And: "Your credibility is now on the line."

Western powers are just as anxious about the rise of the Brotherhood to power, if not more so. They view the group as a bitter foe and especially as a threat to Israel, which signed the Camp David peace treaty with Egypt in 1979, ending the state of war between the two neighbours. Since the 11 September 2001 attacks, fear of Islamism in general, not just of al-Qaeda, has taken hold of the western imagination. Pro-western, autocratic Arab rulers such as Mubarak exploited this unnecessary fear by portraying themselves as partners in the fight against "extremists" of the Muslim Brothers variety and in the struggle for peace. "Either us or the extremists," Middle Eastern dictators warned western officials.

Until his last day in power, when millions of Egyptians called for his departure, Mubarak used the menace of the Brotherhood to warn the US of what lay ahead if he should go. As the political crisis reached a climax at the end of January, Barack Obama telephoned Mubarak and tried to find a way for him to leave the scene gracefully. A White House official summarised the response as: "Muslim Brotherhood, Muslim Brotherhood, Muslim Brotherhood."

Historically, the US and its European allies accepted this binary model of the Middle East, in which religious fundamentalists were seen as the only alternative to pro-western dictators. The implicit assumption among western officials was that there was no third way, no public opinion, only an "Arab street" - code for the notion that Muslims, if allowed to vote, would make the wrong choices, that democratic forces, untried and unknown, would not be as pliant and accommodating to US interests in the region as the autocrats. The late Jeane Kirkpatrick, who served as US ambassador to the UN, quipped about Arabs and democracy: "The Arab world is the only part of the world where I've been shaken in my conviction that if you let the people decide, they will make fundamentally rational decisions."

Secretary of State Hillary Clinton acknowledged as much in a 7 November speech about Washington's response to the Arab spring that toppled several US clients. "For years, dictators told their people they had to accept the autocrats they knew to avoid the extremists they feared," she told an audience at a National Democratic Institute event that included the former secretary of state Madeleine Albright. "Too often, we accepted that narrative ourselves."

In a marked shift of US foreign policy, Clinton said that the Obama administration would work with the ascendant Islamist parties in Tunisia and Egypt if they played by the rules of the political game.

As Egyptians prepare to go to the polls to elect the first free parliament since the fall of Mubarak, all eyes at home and abroad will be watching the performance of the Brotherhood and sizing up its share of parliamentary seats. Myth and reality are intertwined in the Brotherhood. Since the 1920s, when it was established by a charismatic 22-year-old preacher and Arabic teacher named Hassan al-Banna in the city of Ismailia, 60 miles north-east of Cairo, it has evolved from a youth-focused organisation to a broadly based social and political movement. Between the 1940s and 1960s, the Brotherhood kept one foot above ground and another underground. Its "Secret Apparatus", a paramilitary network, carried out assassinations and armed attacks against rival politicians and civilians. Successive governments suppressed the Brothers, culminating in a systemic campaign by the pan-Arab nationalist president Gamal Abdel Nasser to dismantle the organisation and defeat it. Thousands of rank-and-file members were incarcerated and tortured and top leaders executed. They included Sayyid Qutb who, after his execution in 1966, became the master ideologue and theoretician of militant Islamists and was a profound influence on Osama Bin Laden and Ayman al-Zawahiri.

That dark and bloody period came to an end in the 1970s when the leaders of the Brotherhood renounced violence, settling on a strategy of political participation. However, the violent confrontation in the 1950s and 1960s between the two biggest political trends - pan-Arab nationalism and pan-Islamism - created a historic rift that has not yet been bridged. The current secular-religious divide illustrates that the old wounds have yet to heal.

The legacy of imprisonment, persecution and humiliation left deep scars on the Brotherhood's institutional memory, evolution and development.

Among the Old Guard or first generation (an influentially coherent but dwindling segment whose members spent at least a decade in Nasser's dungeons), a sense of martyrdom and an abiding mistrust of the outside world persist. After their release from prison by Nasser's immediate successor, Anwar al-Sadat, in the early 1970s, these conservative veterans focused on rebuilding and replenishing their social networks and gaining legitimation. They put survival, social cohesion and unity above political transparency and accountability. (Sadat's assassination in October 1981 by an Islamist lieutenant precipitated a prolonged conflict between Mubarak, who then became the next president, and the Zawahiri generation of local militants.)

Today, the Old Guard's monopoly of executive power is challenged by a rising generation of pragmatists, university graduates who joined the Brotherhood in the 1970s. The pragmatists are much more at ease with modernity and pluralistic politics than their elders, who have resisted internal attempts to democratise the decision-making process and open up to the outside. Over the years, I have interviewed members of both generations, and the differences in sensibility, world-view and education are striking. Insisting on absolute loyalty and secrecy, members of the Old Guard - such as Mahmoud Izzat, secretary general and gatekeeper of the organisation's finances and secrets; Mohammed Akif, the Brotherhood's former mufti and general guide; and Mohamed Badie, the present general guide - lack the intellectual and political vision to transform the organisation into a transparent, modern political party.

In contrast, members of the 1970s generation - such as Essam el-Arian, vice-president of the Freedom and Justice Party and a law and medical school graduate, and Abdel Moneim Abul-Fotouh, a medical doctor and former member of the Brotherhood's highest executive policy-setting "guidance bureau" - are progressive. They profess commitment to an open society and representative government. Some voiced pointed criticisms of the Old Guard for their autocratic ways and pledged to challenge the status quo once there was an opening in the closed political system under Mubarak.

The balance of power has tipped in favour of the pragmatists and Mubarak's downfall will hasten the transition to the new generation. Abul-Fotouh is a case in point. He has decided to run for the presidency as an independent candidate, against the wishes of the leadership, and submitted his resignation from the organisation. The young Brothers will probably vote for him in defiance of the Old Guard.

During recent years, intergenerational differences within the Brotherhood manifested themselves in an open challenge by young Egyptians to authoritarian practices by the ultra-conservative veterans. Younger Brothers have used new media such as blogs and Facebook to criticise their elders and call for the demo­cratising of the movement as a prerequisite to building a pluralistic civil state in Egypt. Young Brothers are the single largest subgroup in the organisation, and their world-view is closer to that of their liberal and nationalist counterparts than their conservative elders, as shown in the past ten months. Frustrated by the closed leadership, younger members of the Brotherhood established four political parties of their own and were promptly expelled from the organisation for disobedience.

The intergenerational and ideological divisions show that the Brotherhood is not a monolith, frozen in time and space. Far from it: there is increasing evidence that its leaders respond to pressure from within and without and are sensitive to public opinion. In the past decade, they have laboured to reassure critics at home and abroad that they accept the rules of politics and do not wish to establish a theocratic state along the Iranian model. "We'll build a civil state with Islamist references," the head of the Freedom and Justice Party, Mohammad Mursi, told the French ambassador in Cairo this month. Exhibiting maturity during the mass protests against Mubarak, the Brothers stayed in the shadows for fear that they would alarm Egyptians and the western powers.

As the electoral campaign intensifies and concerns mount about the Brotherhood's agenda, the two top leaders of the Freedom and Justice Party, Mursi and el-Arian, have stressed that if they win they will form a government of national unity with other parties. Addressing assertions often made by their secular opponents, they insist that the party "would hand over power if we lose" because the public mood will no longer tolerate dictatorship. El-Arian pledged that Freedom and Justice will not add terminology to the Egyptian national constitution to make explicit old demands that all legislation comply with sharia law. Article 2 of the constitution already states that the "principal source of legislation is Islamic jurisprudence".

The Brotherhood has been denounced for being strongly anti-Israeli and anti-American. Hardliners in the US are sounding the alarm: if the Brotherhood rises to power in Egypt, it "would be calamitous for US security", warns Leslie Gelb, president emeritus of the Council on Foreign Relations, who served as a senior official in the state and defence departments. "It would be delusory to take the MB's democratic protestations at face value," he says.

The sad truth is that the Brotherhood's rhetoric on Israel and US foreign policy does not differ much from that of its nationalist and leftist counterparts. Egyptians of all persuasions feel that their country must reclaim its leadership role in the Arab arena and resist Israel's oppression of the Palestinians.

Increasingly, Egyptians are questioning the utility of the Camp David Accords with Israel, though few call for their abrogation. More than 70 per cent of Egyptians who were recently polled by the New York-based International Peace Institute stated their preference for maintaining the agreement with Israel. This finding is corroborated by polling conducted by Egypt's leading al-Ahram Centre for Political and Strategic Studies.

Similarly, although leaders of the Brotherhood frequently call for all parties to revisit the peace accords, they stress they would not take any unilateral decisions that risk national security but, instead, would submit such decisions to the will of the people. Far from showing brinkmanship and recklessness, senior Brothers say they would uphold diplomatic treaties signed by Egypt, a clear signal of realpolitik. The Brotherhood craves recognition by the western powers and the international community. A cleric and presidential candidate affiliated with the Brotherhood, Hazem Abu Ismail, told CBC TV in September that even though he opposes the peace treaty, he would not abrogate it as a leader, or wage war against Israel.

For more than four decades, Brotherhood leaders laboured to join the political space and gain legal status. They learned the art of compromise and pragmatism through hardship and persecution. Ideology takes a back seat to the interests and political well-being of the Brotherhood. More than ever, their message targets specific constituencies and interest groups - a sign of an ideological shift. In fact, secular opponents criticise leaders of the Brotherhood for being too opportunistic and Machiavellian, too willing to align themselves even with the Mubarak regime and then with the new military leadership to advance their interests. In similar vein, militants such as al-Zawahiri have accused the Brotherhood of sacrificing faith and ideological purity on the altar of a bankrupt political agenda.

In truth, the Brotherhood has been unable and unwilling to free itself from a heavy ideological inheritance. In contrast to Turkish and Tunisian Islamists, the Brothers are allergic to the terms secular and secularism and view them as "anti-Islamic". After welcoming the Turkish prime minister, Recep Tayyip Erdogan, to Egypt in September, the Brotherhood's reception turned hostile when he told a TV channel that religion could coexist with a secular state. "I hope there will be a secular state in Egypt," said Erdogan, a pious Muslim whose AKP party has Islamic roots. A Brotherhood spokesman accused Erdogan of interfering in Egyptian internal affairs.

Particularly alarming is the movement's stance on women and minorities, a position that the Old Guard legitimise on religious grounds. Scriptural interpretations are deployed selectively and haphazardly to claim that women and Christian Copts cannot be fully equal before the law, can't hold the office of president, or even be magistrates. Although this position is contested within the organisation among the pragmatists and younger Brothers, it is a symptom of a greater predicament facing the Brotherhood. Beyond its statist mindset and road map, the organisation has not come up with original ideas and well-delineated socio-economic or political programmes. The body of the Brotherhood has expanded faster than its brain.

The challenge facing the organisation is not to gain a sizable share of seats in parliament but to govern effectively and offer solutions to Egypt's structural crises. Egypt is almost bankrupt. About 40 per cent of the population lives on less than $2 a day. There is mass unemployment and national literacy rates are among the lowest in the Arab world. The country's fragile institutions must be rebuilt painstakingly - at a time when there is no shared vision about the future among opposition groups. And what to do about the quickening appetite of the military for politics?

Time and again over the past two decades, the Muslim Brotherhood's fine-tuned political machine proved its worth and effectiveness. If it wins a majority and forms a government, it will have to deliver the goods. Given the magnitude of the problems that Egypt faces and the organisation's lack of clearly articulated blueprints for job creation to jump-start the economy, the odds are against it. And if it does fail, its election slogans - "Islam is the solution" and "We hold good for Egypt" - will be turned against it with a vengeance.

Fawaz A Gerges is director of the Middle East Centre and professor of international relations at the London School of Economics. His most recent book is "The Rise and Fall of al-Qaeda" (OUP USA, £15.99)