The correct answer is recognize that people will shamelessly seize upon terror attacks in order to push their ideology of hatred and racism under the pretense of caution, then create a self-perpetuating cycle of hate by repeatedly seizing on the violence that they helped push people into. Then you call out those people for what they are and want to implement, and refuse to fall for those people's tricks yourself. Then you continue to not be a judgy presumptuous dick to Muslims just because they're Muslim and don't ignore their problems so that you can prevent, or at the very least not contribute to, radicalization indoctrination by groups like ISIS.
And you can fight those shameless people. I saw it happen with the Boston Marathon bombing-- a horrible event which was ripe for the pickings for extremists, especially since it happened in the very liberal capital of the ardently Democrat state of MA and one of those killed was only 8 years old. But people anticipated and fought attempts to seize upon it. The people of Boston didn't bar Muslims and Arabs from mourning the event or expressing Boston Strong sentiments, and made it as clear as possible that the bombing would not be allowed to be held against the Muslims of the community and that while more safety precautions would be made to prevent terrorist attacks, they would not specifically target Muslims and would rather be more general stuff like "no large backpacks at the marathon next year". Somebody even bought the domain "bostonmarathonconspiracy.com" to prevent conspiracy theorists from using that name to allege a conspiracy, and it corresponded to a simple website with a short message explaining the intent of the purchase and urging people to donate and help those affected (its gone now, but it lasted long past the point where the bombing would be hot enough news to entice opportunistic conspiracy theorists). Furthermore, a greater emphasis was placed on covering and aiding the victims of the bombing than the bombers themselves-- the victims were seen as the ones that needed to be heard, respected, and publicized, not the terrorists. Yes, a movement of people who admired the terrorists for being "hot" or "troubled but cute" or "justified" and didn't want the one surviving guy to be punished did crop up. But as you might expect, it wasn't fuelled or condoned by the locals, who viewed the whole thing as either malicious trolling, Darwin award levels of stupid, or some combination of the two. And the locals were always sure to emphasize the victims over the terrorists in their condemnations. Even the use of the surviving terrorist's face on the cover of Rolling Stone magazine was condemned as deeply offensive to the victims, and by extension an insult to the whole of Boston. Because of that fighting, a clear message was sent that racism wouldn't be allowed to gain any support in Boston because of the bombing, and that the terrorists would not be focused on at the expense of the victims or anybody else for that matter. Plus it meant that that movement of sympathizers dissipated quickly and gained no ground. A horrible event was made into the stepping stone of multiple crowning moments of awesome and heartwarming thanks to the cooperation, proper priorities, persistence, and overall strength of the citizens and government of Boston.
Short term, no large spike in hate crime against Muslims in the area resulted because the message was clear that it would be watched for and not tolerated. Long term, it hasn't caught on large-scale to justify hatred. Because Boston anticipated those things and was (and still is in some ways) proactive about dealing with them. I know that other cities are perfectly capable of fighting hatred like that-- the question is, will they? Not every city is like Boston, after all. Please, whatever you do, make sure they do.