For the first time I can remember, I agree with Newt Gingrich about something: President Obama should have been in Paris on Sunday, walking arm-in-arm with François Hollande, Angela Merkel, and other world leaders. Ultimately, the march from the Place de la République was an expression of support for the values of the French Revolution—liberty, equality, and fraternity, which are the same values that underpinned the American Revolution. For moral, strategic, and diplomatic reasons, the de-facto leader of the free world should have been there.

On Monday, Josh Earnest, the White House spokesman, admitted the obvious, saying, “We should have sent someone with a higher profile.” Later this week, John Kerry is flying to France in a show of solidarity. (The State Department insists that Kerry’s stop-off in Paris was in the works before this.) In one sense, though, Obama’s decision to stay in the U.S. may turn out to have some unintended positive consequences.. In confronting the threat of homegrown jihadists, France and other European countries need to plot their own course. If they rely too heavily on U.S. advice, they could end up making the same errors the United States did after 9/11, and that would be tragic.

In 2002 and 2003, the United States and its allies fell into Osama bin Laden’s trap by invoking the language of war, marching into Iraq, and occupying sacred Muslim sites. The Holy War against Western invaders that bin Laden imagined himself leading became a reality: in places like Syria and Iraq, it’s still going on. The French government was wise enough to sit out the ill-fated Bush–Blair crusade. Despite France’s recent actions in Mali and Syria, two countries where its military forces have engaged radical Islamist, there remains little prospect that it will invade a Muslim country. But what will it do at home?

Clearly, France needs to beef up security around potential terrorist targets, as well as take a look at its internal security agencies, which failed to keep tabs on three attackers who were known to be supporters of violent jihad. But there’s also a possibility that the French government will overreact, plunging France and other European nations into conflict with the millions of Muslims living in their own countries—something that organizations like Al Qaeda and ISIS would love to see, and whose consequences might be disastrous.

From the images of the past few days, it’s plain that last week’s attacks have riled up the French public in a way that is, in some ways, redolent of the aftermath of the U.S. reaction to 9/11. On Sunday, millions of people took to the streets of Paris and other French cities. In addition to holding up signs that read “JE SUIS CHARLIE,” many of the marchers were carrying the French tricolor and singing "La Marseillaise." This outburst of patriotism was entirely predictable, and, in some ways, it is to be commended. But patriotism blends easily into nationalism, which, in turn, can be used to justify illiberal actions. In a country that has already banned the burka from public places, whose treatment of its immigrant population has long been a blot on its reputation, and where an explicitly anti-immigrant party, the National Front, gained twenty-five per cent of the vote in recent elections to the European Parliament, the potential for a lurch toward oppressive and counterproductive policies cannot be entirely dismissed.

On Saturday, Manuel Valls, the French Prime Minister, declared, "It is a war against terrorism, against jihad, against radical Islam, against everything that is aimed at breaking fraternity, freedom, solidarity,” thereby engaging in a bit of alarming, if understandable, rhetorical escalation. Valls’s boss, President Hollande, has been more measured in his comments. “Those who committed these terrorist acts, those terrorists, those fanatics, have nothing to do with the Muslim religion,” he said last Friday. But Hollande, whose approval ratings are dismal, is under strong pressure to act.

On Monday, after Hollande chaired a domestic-security meeting, his government announced that it was dispatching ten thousand soldiers to secure vulnerable sites around the country—the first time that French troops have been mobilized in such a manner. So far, no further measures have been announced, but many observers expect a crackdown on suspected militant Islamist that would mimic, or exceed, the measures taken by President Nicolas Sarkozy shortly before the Presidential election in 2012. The danger is that, in stepping up its policing and surveillance, especially of young men of Algerian descent, the French government could provide more recruits to the jihadist cause. And, if this crackdown extends to other areas, such as strengthening and enforcing France’s anti-religious laws, the consequences could be doubly harmful.

It’s long been clear that France faces a big problem in integrating its Muslim citizens, most of whom are native-born—as were Chérif and Saïd Kouachi, who carried out the attacks at Charlie Hebdo, on Wednesday, and Amedy Coulibaly, who was responsible for the hostage crisis at a kosher supermarket on Friday. Partly, this is an economic issue: in cities like Paris, the population that hails from North Africa experiences high levels of poverty and low levels of social mobility, which hinders efforts to integrate with the rest of society. But there is also a cultural issue. France, with its long and distinctive tradition of secularism, which dates back to the revolutionary struggles against the Catholic Church, has insisted that Muslim immigrants and their children adapt to the French way of doing things—for instance, that they not cover their heads with scarfs. Even in cities such as Marseilles, where, according to some estimates, more than a third of the population is Muslim, these anti-religious laws are strictly enforced.

The rationale for such policies is that they treat everybody the same and promote assimilation. But they also play into the hands of radical Islamic preachers and agitators, who portray Muslims as the victims of oppressive western governments. The Kouachi brothers didn’t start out as religious zealots. Far from it. According to news reports, they were born, in Paris, to broken families, and spent some of their childhoods in foster homes. As teen-agers, they liked sports, rap music, and smoking marijuana. Partly at the instigation of a local janitor-turned-imam, they were radicalized and, eventually, became terrorists.

This is a depressingly recognizable story. And the remedies for homegrown jihadists, although difficult to enact, are also familiar.

The first is effective policing and surveillance. In the past couple of years, thousands of young Muslims have travelled to Syria and elsewhere to engage in militant jihad. The danger of further attacks is all too obvious. European governments need to come up with better ways of tracking the movements of these jihadists, both when then they set out and after they return—a mighty challenge. Until last week, French authorities appeared to have been doing a pretty good job of surveillance, and their methods were widely admired in counterterrorism circles. Clearly, though, there is more to be done, and not just in France. Last week, in a rare public appearance, Andrew Parker, the head of MI5, Britain’s domestic-intelligence service, said that in the past few months alone U.K. authorities had stopped three potentially deadly attacks.