Germany is a nervous country right now—nervous about what can go wrong. But it is also a moment in which Germany has to demonstrate leadership in its own interests and those of Europe as a whole.

Germans have a tendency to believe in a version of Murphy’s law: what can go wrong will go wrong. There is even a cynical slogan that people sometimes use when wishing someone good luck “Es wird schon schief gehen.” (Something will go wrong.)

Right now, that applies to the refugee crisis spilling over Germany. It dominates the media, permeates the TV talk shows (of which there are many,) and frustrates the political process at all levels. Despite the attitude espoused by Chancellor Merkel—”we can do this”—there is a good deal of grassroots backlash emerging. Germans are worried that the initial welcome wagon approach to the refugees is going to cause the country to be overwhelmed by the unknown numbers of people seeking asylum. That worry can be useful fodder for right-wing opportunistic groups and political parties, which have marginal impact at the moment but remain worrisome.

Of course, a quick look around Europe can remind us that ignoring these trends in public opinion can be a dangerous mistake. Recent elections in Austria and Switzerland gave right-wing groups a greater voice in the governments in Vienna and Bern. France is watching the National Front gain traction. And there is Hungary’s response to the refugees with barbed wire fences and the anti-immigrant mood spreading in the UK. In this context, Germany is no less susceptible to these trends. There is a mixture of fear and frustration in parts of the general public parallel to posturing and pandering by some political figures. Yet that is not representative of the whole picture. If a large and loud group of right-wing demonstrators gathers to protest about the migrant crisis, there is an equally large crowd to demonstrate for a more tolerant approach to the challenge, apart from the efforts at the local and regional levels to arrange housing and care for the ever-growing number of refugees.

Yet it is evident that Germans are uncertain about the country’s capacity to deal with what appears to be an unending river of refugees streaming into Europe and seemingly all wanting to reach Germany. Chancellor Merkel has given voice to the position that Germany has an obligation to give asylum to those who merit protection—something that is not only part of the German constitution, but also part of Germany’s legacy.

But other Europeans are not buying into that, and many Germans are worried that Merkel has overreached. The recent EU summit meeting in Brussels did little to forge a consensus.

Amid the thousands of refugees steaming across the Europe, some are seeking asylum from war zones. Others are seeking a new and better life. As the numbers of people flowing into the streets and towns approaches over a million (with no clear end in sight), Merkel is being criticized as a Pandora who had opened a bottomless box. The areas where thousands of refugees are being housed appear to many Germans as a threat for which they are not prepared. The emergence of violent attacks against refugee centers, along with right-wing movements such as Pegida or the Alternative for Germany, add fuel to the emotional fire around this enormous challenge in Germany and throughout Europe.

Amid all of this turmoil, there is a mix of racism, fear of losing a way of life, and economic uncertainty. A lot has to do with a sense of competing identities—national, regional, and ethnic. All of that is nothing new to a Germany that has been marked by much diversity over centuries. Yet that is not the narrative of those who are simply scared of the present and the future.

But there is clearly one particular factor that is causing a serious cleavage—the clash over religious identities. Of the many migrants coming into Germany now, the vast majority are affiliated with the Islamic faith. That is nothing new. An estimated four million Muslims already live in Germany, three quarters of whom are of Turkish origin and many have decades of experience living in Germany. Muslims coming from Arab regions are shaped by different, more conservative, traditions within Islam. The effort to deal with the integration of Muslims into German society is not new. Yet it will be much more challenged with this new wave of migrants. And there are clearly concerns about the potential of extremists mixing in that wave and proselytizing among the younger generations trying to find their way in new surroundings. However, it should not be forgotten that thousands of these migrants are fleeing from extremists and seeking asylum from that threat. How many would choose to return home if their lives were better is unclear. But if they want to stay in Europe, they are going to be challenged to adjust to that environment—legal, political, and cultural.

Although Chancellor Merkel has become a target of the backlash, she is standing by her slogan “we can do this” by adding that she meant that we can do this—but not alone. This challenge is going to be European in scope. It will test the mettle of the word Union far more than the euro crisis. And it may change the map of Europe in more ways than previously imagined.

But for now, she will face a German public, a good part of which is uncertain about the future and the capacity of its political leadership to deal with the challenge. The challenge is not only for the chancellor. This is going to be a long-term project at all levels of government. Local communities are dealing with this challenge in multiple directions—providing shelter, instruction for refugees on how to cope with their situation, language instruction, and even mediating the clashes within the refugee groups. They are bearing these immediate burdens.

The state governments are struggling to organize and pay for the responses, and they are demanding control mechanisms from Berlin. Bavaria’s leadership has been particularly critical of Berlin, given the southeastern state’s immediate exposure to the flow of migrants.

The federal government needs to exercise its responsibility and set up a sustainable and credible policy designed to control its borders. Given its own recent history, German policymakers will not want to construct barbed wire fences and police barriers as the Hungarian government did on its borders.

Merkel has continued to remind Germans about humanitarian responsibilities when it comes to dealing with the individuals coming across their borders. While that has been met with public support in Germany, turning that into effective policy has been much harder because of the enormous pace at which the problem is developing.

Merkel now has another moment to lead Europe in dealing with this challenge. As many other EU partners are dealing with their own domestic turmoil over this issue, finding common purpose and policy is difficult. Forging a EU consensus to deal with any challenge is always a struggle. In early 2016, Merkel herself will be facing pivotal state elections, which will act as political barometers measuring how well she is doing in dealing with this crisis. A year later, she will face a federal election, which could give her a fourth term in office, or carry a backlash that might end her era as chancellor.

That is likely not a dominant concern for her right now. She is looking at the immediate challenges facing her country and her European counterparts with an eye on what to do not only about the masses of migrants fleeting to Europe, but also about the very forces driving them from their homes. The two issues need to be addressed together. The myopic obsession of blocking the borders without thinking about what to do with both those migrants forced to turn back, as well as the conditions that led them to flee in the first place is creating a vicious circle.

The clocks on both ends of this challenge are ticking. The consistent patience needed to deal with domestic concerns has to be matched by patient but consistent efforts to help to stop the bleeding of those masses of people suffering from the forces of war and seeking a safer future.

This is a challenge that can act as a positive catalyst for Europe to rethink and restart its project…or it can cause more fragmentation and fissures to emerge. It is hard to see which is more likely to emerge first.