"Islam is under attack," a mullah in Baghdad told me when I asked him why the resistance to the American military occupation of his country had become so stridently religious. In his reckoning, the US had imposed its presence in the region not only to liberate Iraq from a dictator but also to establish an American-style secular political regime, and the Iraqis were responding in kind.

"You Americans will not succeed," he went on to tell me, "for Islam will prevail."

Mark Juergensmeyer's spread from New Humanist, July/August 2008What was striking about his comment was the idea that the US was opposed not just to Saddam Hussein but also to Islam. In his view the US military forces were aimed at religion, and he thought that Iraq would not be truly free until it had established Muslim rule.

It was the struggle for freedom, the mullah explained, that justified the violence - even the improvised explosive devices that killed both Iraqi civilians and American soldiers. There was nothing intrinsically bloody about Islam, he assured me, adding that the point of all this conflict was to establish a righteous reign of peace.

Though many of the anti-American mullahs in Iraq now distance themselves from the most extreme forms of terrorism, the car bombings in Iraq persist. They evoke the horrific images of earlier attacks - the explosions in the London subways in 2005, the Madrid train bombings in 2004, the catastrophic assault on the World Trade Center and Pentagon on September 11, 2001, and all of the other recent examples of the explosive power of religion.

The images are not all Muslim, however. Jewish extremists in Israel killed innocent Muslims in a mosque in Hebron and assassinated Israel's Prime Minister Yitzhak Rabin. Hindu fanatics in India destroyed an ancient mosque in Ayodhya, and Sikhs assassinated Prime Minister Indira Gandhi. The largest terrorist attack in the United States prior to 9/11 was perpetrated by a Christian militant, Timothy McVeigh, in the destruction of the Oklahoma City Federal Building. Militant Buddhist monks have been involved in violent assaults in Sri Lanka, and members of a Buddhist sect in Japan unleashed nerve gas in the Tokyo subways.

I have been to all of these places where violent religious activism has been on the rise and interviewed scores of activists who have been on the front lines of what appears to be a virtually global rebellion against the secular state. I have tried to get inside the mindset of militant mullahs in Iraq, leaders of Hamas in Palestine, supporters of al Qaeda around the world, members of the Christian militia in the United States, Jewish radicals in Israel, Buddhist activists in Sri Lanka and Japan, and Hindu and Sikh extremists in India.

What I have tried to find out is why these militant uprisings are occurring now, throughout the world and in virtually every religious tradition. And I have wanted to know what religion has to do with it.

My conclusion is that these incidents of religious violence are not really about religion. I do not think that Islam is any different from any other religious tradition with regard to violence. All religious faiths can be used to promote political causes and justify violent acts. I also do not think that there is a new mutation of religion that has infected the world's cultures. It would be mistaken to assume that religion has suddenly gone bad in the first decade of the 21st century. Rather, it seems to me, radical religious ideologies have become the vehicles for a variety of rebellions against secular authority that are linked with non-religious issues, a myriad of social, cultural and political grievances.

Yet religion gives more than a voice for the dispossessed. In many cases it also provides a basis for a fundamental critique of the modern nation-state. In doing so, it challenges the legitimacy of secular institutions and national identity. For this reason the religious activists involved in radical assaults on the symbols of secular society and national authority should be taken seriously. They are not only temporary social nuisances, but also expressions of a widespread cultural and political rejection of what modern persons used to consider the inevitable wave of the future: the 20th-century Western vision of an international order based on a network of discrete national societies in a secular nation-state world.

In a prison interview, Mahmoud Abouhalima, who was convicted of being one of the prime organisers of the 1993 attack on the World Trade Center, told me that the nation-state was part of the problem. "Your government is the enemy," he told me, explaining that his native land of Egypt would not be truly free until it was liberated from American and other Western ideas of nationality.

Religious ideologies have emerged in the 21st century as new bases for political legitimacy and national identity at a time when the nation-state is vulnerable. In an era of economic globalisation and the mobility of traditional populations, and in the wake of secular nationalism's failure to deliver its promises of human rights, democracy and economic progress to countries around the world, the premises of modern secular nationalism are under attack. In the ruins of modernism, religion has risen like a Phoenix to provide the legitimacy and identity necessary for public order.

Born as a stepchild of the European Enlightenment, the idea of the modern nation-state is profound and simple: the state is created by the people within a given national territory. Secular nationalism - the ideology that originally gave the nation-state its legitimacy - contends that a nation's authority is based on the secular idea of a social compact of equals rather than on ethnic ties or sacred mandates. It is a compelling idea, one with pretensions of universal applicability. It reached its widest extent of world-wide acceptance in the mid-20th century.

But the latter half of the century was a different story. The secular nation-state proved to be a fragile artifice, especially in those areas of the world where nations had been created by retreating colonial powers - in Africa and the Middle East by Britain and France; in Latin America by Spain and Portugal; in South and Southeast Asia by Britain, France, the Netherlands and the United States; and in Eurasia by the Soviet Union. In some cases boundary disputes led to squabbles among neighbouring nations. In others the very idea of the nation was a cause for suspicion.

Many of these imagined nations - some with invented names such as Pakistan, Indonesia and Yugoslavia - were not accepted by everyone within their territory. In yet other cases, the tasks of administration became too difficult to perform in honest and efficient ways. The newly-created nations had only brief histories of prior colonial control to unite them, and after independence they had only the most modest of economic, administrative and cultural infrastructures to hold their disparate regions together.

By the 1990s these ties had begun to fray. The global economic market undercut national economies, and the awesome military technology of the US and NATO reduced national armies to border patrols. More significantly the rationale for the nation-state came into question. With the collapse of the Soviet Union and the post-colonial, post-Vietnam critique of Western democracy, the secular basis of the nation-state seemed increasingly open to criticism. In some instances, such as in Yugoslavia, when the ideological glue of secular nationalism began to dissolve, the state fell apart.

In other places the economic promises of the Western models of modernisation seemed to come up empty, especially in places where local leaders felt exploited by the global economy - as in Iran and Egypt - or believed that somehow the benefits of economic globalisation passed them by. The global shifts in economic and political power that occurred following the break-up of the Soviet Union and the rise of Asian economies also had significant social repercussions.

At one time, leaders such as India's Jawaharlal Nehru, Egypt's Gamal Abdel Nasser and Iran's Riza Shah Pahlavi tried to create their own versions of America - or in some cases a cross between America and the Soviet Union. But following after them a new, postcolonial generation no longer believed in the Westernised vision of Nehru, Nasser or the Shah. Rather, it wanted to complete the process of decolonialisation by asserting the legitimacy of their countries' own traditional values in the public sphere and constructing a national identity based on indigenous culture. The need for local control seemed pressing in the global media assault of Western music, videos and films that satellite television beams around the world, which threaten to obliterate local and traditional forms of cultural expression.

In other cases it has been globalisation - the emergence of multicultural societies through global diasporas of peoples and cultures, and the suggestion of global military and political control in a "new world order" - that has elicited fear. Perhaps surprisingly, this response has been most intense in the most developed countries, which in other ways seem to be the very paradigm of globalisation.

In Europe, the presence of large immigrant populations from the Middle East ignited new forms of racism and new fears of the erosion of national values. In the United States, the Christian militia organisations were animated by fears of a massive global conspiracy involving liberal American politicians and the United Nations. In Japan a similar conspiracy theory motivated leaders of the Aum Shinrikyo movement to predict a catastrophic Third World War, which their nerve gas assault in the Tokyo subways was meant to emulate.

As far-fetched as the idea of a "new world order" of global control may be, there is some truth to the notion that the integration of societies, communication among disparate peoples and the globalisation of culture have brought the world closer together. Although it is unlikely that a cartel of malicious schemers has designed this global trend, its effect on local societies and national identities has nonetheless been profound. It has undermined the modern idea of the nation-state by providing non-national and transnational forms of economic, social and cultural interaction. The global economic and social ties of the multicultural inhabitants of contemporary global cities are linked together in a way that supersedes the Enlightenment notion that peoples in particular regions are naturally linked together in a social contract. In a global world, it is hard to say where particular regions begin and end. For that matter, it is hard to say how one should define the "people" of a particular nation.

This is where religion and ethnicity step in to redefine public communities. The fading of the nation-state and old forms of secular nationalism have produced both the opportunity for new nationalisms and the need for them. The opportunity has arisen because the old orders seem so weak; and the need for national identity persists because no single alternative form of social cohesion and affiliation has yet appeared to dominate public life the way the nation-state did in the 20th century. In a curious way, traditional forms of social identity have helped to rescue the idea of national societies. In the increasing absence of any other demarcation of national loyalty and commitment, these old staples - religion, ethnicity and traditional culture - have become resources for national identification.

In the contemporary political climate, therefore, religious nationalism provides a solution to the problem of Western-style secular politics in a non-Western and multicultural world. As secular ties have begun to unravel in the post-Soviet and post-colonial era, local leaders have searched for new ways to ground their social identities and political loyalties. Many have turned to religion.

This is where the new religious activists enter the picture. In India, for instance, modern Hindu and Sikh politicians anchor their political rhetoric in the bedrock of religious tradition. They often reach back in history for ancient images and concepts that will give their ideas credibility, but they are not simply resuscitating old ideas from the past. In the idea of a Sikh nation of Khalistan and in the Bharatiya Janata Party's notion of an Indian culture of hindutva, they are providing contemporary ideologies that meet present-day social and political needs.

In the modern context this is a revolutionary notion - that indigenous culture can provide the basis for new political institutions, including revived forms of the nation-state. Since they challenge secular politics in fundamental ways, movements of ethno-religious nationalism are often confrontational and sometimes violent. They reject the intervention of outsiders and their ideologies and, at the risk of being intolerant, pander to their indigenous cultural bases and enforce traditional social boundaries. It is no surprise, then, that they get into trouble with each other and with defenders of the secular state. Yet even such conflicts with secular modernity serve a purpose for the movements: they help define who they are as a people and who they are not. They are not, for instance, secularists. And they are not pawns in the power of globalisation. As one supporter of the Christian Right in the United States told me, "our enemy is the new world order."

Although the members of many radical religious and ethnic groups may appear to fear globalisation, what they distrust most are the secular aspects of globalisation. They are afraid that global economic forces and cultural values will undercut the legitimacy of their own bases of identity and power. Other aspects of globalisation are often perceived by them as neutral and, in some instances, useful for their purposes. Global communications, for instance, provide a vital link between expatriate groups. Mobile phones and the internet are vital tools in the new religious rebellion.

Some groups have a global agenda of their own, a transnational alternative to political nationalism. Increasingly terrorist wars have been waged on an international and transnational scale. Osama bin Laden, from his encampment in Afghanistan, has helped to orchestrate acts of terrorism around the world.

These worldwide attacks may be seen as skirmishes in a new Cold War between religious politics and the secular state. It might also be described more dramatically as a "clash of civilisations", as the Harvard political scientist Samuel Huntington once termed it. Though most intellectuals disagree with Huntington's characterisation of this all-encompassing "we-they" view of the world, the use of the "clash of civilisations" phrase in policy discussions has become ubiquitous, and it carries with it a kind of self-fulfilling prophecy. When the United States, for instance, acts as if Western civilisation is at war with Islamic civilisation, this attitude helps to bring about a similar kind of response.

One group of activists who appear to agree with Huntington are Islamic extremists. They contend that they are intrinsically part of Islamic, not Western, civilisation, and it is an act of imperialism to think of them in any other way. Proponents of extreme versions of Islamic politics, therefore, often see themselves as a part of a larger, global encounter between Western and Islamic cultures. This view of a "clash of civilisations" - although at present confined to the imaginations of Huntington and a small number of Islamic radicals - might become a dominant theme in the political unrest of the 21st century.

An even more troubling version of this global cultural clash is an apocalyptic one, in which contemporary politics is seen as fulfilling an extraordinary religious vision. Ideas such as this are held by extremists in many religions. Some Messianic Jews, for instance, think that the Biblical age that will be ushered in at the time of the return of the Messiah is close at hand. It will occur when the Biblical lands of the West Bank are returned to Jewish control and when the Jerusalem temple described in the Bible is restored on its original site - now occupied by a Muslim shrine, the Dome of the Rock. American Christian political activists such as Jerry Falwell and Pat Robertson have been animated by the idea that the political agenda of a righteous America will help to usher in an era of global redemption. The leader of Japan's Aum Shinrikyo predicted that a new Armageddon would envelop the world in a Third World War.

These are transnational ideas, since they envision the world as caught up in a cosmic confrontation, one that will ultimately lead to a peaceful world order constructed through a dramatic religious transformation. Fortunately, these are apocalyptic fantasies at present held by only a marginal few at the fringes of Christianity, Judaism, Islam and Buddhism. Yet these ideas should be taken seriously, since they picture a form of global order radically different from secular versions of globalisation, and can set the stage for ideological confrontation on a global scale.

Emerging movements of religious politics are therefore ambivalent about globalisation. To the extent that they are nationalistic they often oppose the global reach of world government, at least in its secular form. But the more visionary of these movements also at times have their own transnational dimensions, and some dream of world domination shaped in their own ideological images. For this reason one can project different futures for religious politics in a global world - one where the rebellion of religious activism becomes routine and merges with domestic politics; another where it rails against nationalism and the secular forms of globalisation, and envisions its own transnational future.

The goal of some religious activists is the revival of a nation-state that avoids the effects of both secular modernism and globalisation. Movements such as Hamas in Palestine and Hizbollah in Lebanon have developed political as well as paramilitary wings. Where new religious states have emerged, they tend to be isolationist. In Iran, for instance, the ideology of Islamic nationalism that flourished during and after the 1979 revolution, and that was propounded by the Ayatollah Khomeini and his political theoretician Ali Shari'ati, was intensely parochial. It was not until some 20 years later that new movements of moderate Islamic politics in Iran began to encourage its leaders to move out of their self-imposed international isolation. In Afghanistan, the brief reign of the Taliban kept that country even more isolated from outside influences.

Other movements of religious nationalism have not been quite as isolationist, however. In India, when Hindu nationalists in the Bharatiya Janata Party (BJP), "Indian People's Party", came to power in 1998 - a victory that lasted until the resurgence of the Congress Party in the 2004 national elections - some observers feared that India would become isolated from world opinion and global culture as a result. The testing of nuclear weapons as one of the BJP's first acts in power did little to dispel these apprehensions. But in many other ways, including its openness to economic ties and international relations, the BJP maintained India's interactive role in the world community. Credit for this was due, in part, to the moderate leadership of the BJP Prime Minister, Atal Bihari Vajpayee, one of the country's most experienced and temperate politicians.

If other movements of religious and ethnic nationalism come to power, will they behave like Iran or the BJP? Observers monitor developments in Pakistan, Egypt and Algeria closely for signs of anti-global sentiment, aware that the considerable strength of religious politics in those regions might lead to the establishment of religious states. When Abdurrahman Wahid, a Muslim cleric, edged past the daughter of Indonesia's founder to become the country's Prime Minister in 1999, observers wondered whether he would usher in an era of religious nationalism. In this case, however, the fears were unfounded. The actions of his government showed Wahid's brand of Islam to be moderate and tolerant, and committed to bringing Indonesia into the world community and the global economic market.

In other regions of the world it is not the creation of new religious states that is at issue but the breakdown of old secular states with no clear political alternative. In some instances, religious and ethnic activists have contributed to these anarchic conditions. In the former Yugoslavia the bloodshed in Bosnia and Kosovo was caused by the collapse of civil order as much as by the efforts to create new ethnic and religious regions. Because these situations have been threats to world order they have provoked the intervention of international forces such as NATO and the UN.

It is, however, precisely world order that some other religious activists oppose. Both Christian militia in the United States and Muslim activists connected to al-Qaeda are convinced that globalisation is a project designed to extend the reach of secular values around the world. They note that the increasingly multicultural societies of most urban communities have undermined traditional cultures and their leaders. They have imagined the leaders of the United States and the United Nations to be agents of an international conspiracy, one that they think is hell-bent on forming a homogenous world society and a global police state. It was this spectre that drove an American extremist, Timothy McVeigh, into a dramatic attack on a symbol of federal control in America's heartland, the Oklahoma City Federal Building. From what is known of the motives of those extremists involved in the tragic attack on railroad trains in Madrid in 2004, Spain's role in world politics was one of the reasons for the assault. Such attacks therefore are attempts to weaken not only a particular government but also a whole global system. They are acts of what might be considered "guerrilla anti-globalism".

Ultimately, however, it seems likely that despite these efforts to ignore or reject the forces of globalisation, transnational cultures will expand, and among them will be strong strains of religion. One future form of religious transnationality may emerge from the international relations of kindred religious states. According to one theory of global Islamic politics that circulated in Egypt in the 1980s and '90s, local movements of Muslim politics were meant to be only the first step in creating a larger Islamic political entity - a consortium of Muslim nations. In this scenario, religious nationalism would be the precursor of religious transnationalism. Transnational Islam would lead to Islamic versions of such secular consortia as NAFTA and the European Community. In the Islamic model, however, the divisions among states would eventually wither away when a greater Islamic union is formed. Osama bin Laden has made veiled references to the Ottoman Empire as a kind of transnational Islamic power that might replace the nation-states of the Middle East.

A second kind of transnational association of religious and ethnic activists has developed in the diaspora of cultures and peoples around the world. Rapid internet communication allows members of dispersed ethnic and religious communities to maintain a close association. These "email ethnicities" are not limited by any political boundaries or national authorities. Expatriate members of separatist communities - such as India's Sikhs, and both Sinhalese and Tamil Sri Lankans - have provided funding and moral support to their compatriots' causes. In the case of Kurds, their "nation" is spread throughout Europe and the world, united digitally. In some cases these communities long for a nation-state of their own; in other cases they are prepared to maintain their non-state national identities for the indefinite future.

Each of these futures contains a paradoxical relationship between the national and globalising aspects of religious politics. This suggests that there is a symbiotic relationship between religion and globalisation. It may appear ironic, but the globalism of culture and the emergence of transnational political and economic institutions enhance the need for local identities. They also create the desire for a more localised form of authority and social accountability.

The crucial problems in an era of globalisation are identity and control. The two are linked, in that a loss of a sense of belonging leads to a feeling of powerlessness. At the same time, what has been perceived as a loss of faith in secular nationalism is experienced as a loss of agency as well as identity. For these reasons the assertion of traditional forms of religious and ethnic identities is linked to attempts to reclaim personal and cultural power. The vicious outbreaks of religious violence that have occurred in New York, London, Madrid and elsewhere in the world in the first decade of the 21st century can be seen as tragic attempts to regain social control through acts of violence. Until there is a surer sense of citizenship in a global order, religious visions of moral order will continue to appear an attractive, even at some level a rational, solution to the problems of identity and belonging in a global world.