Much western journalism in the six years since 9/11 has concentrated on terrorist groups, jihadis and suicide bombers. But while the threat of violence remains very real, those commentators who have compared what they ignorantly call "Islamofascism" to the Nazis are guilty of hysteria: the differences in relative power and military capability are too great for the comparison to be valid, and the analogies that the neocons draw with the second world war are demonstrably false. As long as the west interferes in the Muslim world, bombs will go off; and as long as Britain lines up behind George Bush's illegal wars, British innocents will die in jihadi atrocities. But that does not mean we are about to be invaded, nor is Europe about to be demographically swamped, as North American commentators such as Mark Steyn claim: Muslims will make up no more than 10% of the European population by 2020.

Yet in concentrating on the violent jihadi fringe, we may have missed the main story. For if the imminent Islamist takeover of western Europe is a myth, the same cannot be said for the Islamic world. Clumsy and brutal US policies in the Middle East have generated revolutionary changes, radicalising even the most moderate opinion, with the result that the status quo in place since the 1950s has been broken.

Egypt is typical: at the last election in 2005 members of the nominally banned Muslim Brotherhood, standing as independents, saw their representation rise from 17 seats to 88 in the 444-seat people's assembly - a five-fold increase, despite reports of vote-rigging by President Mubarak's ruling National Democratic Alliance. The Brothers, who have long abjured violence, are now the main opposition.

The figures in Pakistan are strikingly similar. Traditionally, the religious parties there have won only a fraction of the vote. That began to change after the US invasion of Afghanistan. In October 2002 a rightwing alliance of religious parties - the Muttahida Majlis Amal or MMA - won 11.6% of the vote, more than doubling its share, and sweeping the polls in the two provinces bordering Afghanistan - Baluchistan and the North West Frontier Province - where it formed ultra-conservative and pro-Islamist provincial governments. If the last election turned the MMA into a serious electoral force, there are now fears that it could yet be the principle beneficiary of the current standoff in Pakistan.

The Bush administration proclaimed in 2004 that the promotion of democracy in the Middle East would be a major foreign policy theme in its second term. It has been widely perceived, not least in Washington, that this policy has failed. Yet in many ways US foreign policy has succeeded in turning Muslim opinion against the corrupt monarchies and decaying nationalist parties who have ruled the region for 50 years. The irony is that rather than turning to liberal secular parties, as the neocons assumed, Muslims have lined up behind parties most clearly seen to stand up against aggressive US intervention.

Religious parties, in other words, have come to power for reasons largely unconnected to religion. As clear and unambiguous opponents of US policy in the Middle East - in a way that, say, Musharraf, Mubarak and Mahmoud Abbas are not - religious parties have benefited from legitimate Muslim anger: anger at the thousands of lives lost in Afghanistan and Iraq; at the blind eye the US turns to Israel's nuclear arsenal and colonisation of the West Bank; at the horrors of Abu Ghraib and the incarceration of thousands of Muslims without trial in the licensed network of torture centres that the US operates across the globe; and at the Islamophobic rhetoric that still flows from Bush and his circle in Washington.

Moreover, the religious parties tend to be seen by the poor, rightly or wrongly, as representing justice, integrity and equitable distribution of resources. Hence the strong showing, for example, of Hamas against the blatantly corrupt Fatah in the 2006 elections in Palestine. Equally, the dramatic rise of Hizbullah in Lebanon has not been because of a sudden fondness for sharia law, but because of the status of Hassan Nasrallah, Hizbullah's leader, as the man who gave the Israelis a bloody nose, and who provides medical and social services for the people of South Lebanon, just as Hamas does in Gaza.

The usual US response has been to retreat from its push for democracy when the "wrong" parties win. This was the case not just with the electoral victory of Hamas, but also in Egypt: since the Brothers' strong showing in the elections, the US has stopped pressing Mubarak to make democratic reforms, and many of the Brothers' leading activists and business backers, as well as Mubarak's opponent in the presidential election, are in prison, all without a word of censure from Washington.

Yet on a recent visit to Egypt I found everywhere a strong feeling that political Islam was there to stay, and that this was something everyone was going to have to learn to live with; the US response had become almost irrelevant. Even the Copts were making overtures to the Brothers. As Youssef Sidhom, who edits the leading Coptic newspaper, put it: "They are not going away. We need to enter into dialogue, to clarify their policies, and end mutual mistrust."

The reality is that, like the Copts, we are going to have to find some modus vivendi with political Islam. Pretending that the Islamists do not exist, and that we will not talk to them, is no answer. Only by opening dialogue are we likely to find those with whom we can work, and to begin to repair the damage that self-defeating Anglo-American policies have done to the region, and to western influence there, since 9/11.

· William Dalrymple is the author of The Last Mughal: The Fall of a Dynasty, Delhi 1857.

www.williamdalrymple.com