Counterterrorism policies aiming to make America safe from homegrown Islamic radicalism may in fact do the exact opposite — sending some Muslim Americans to seek out ISIS, researchers reported Wednesday.

They found that in communities where people express strong anti-Muslim sentiment, someone — it’s not clear who — is also making internet searches about how to join the Islamic State in Iraq and Syria.

The findings support arguments that cracking down on Muslim communities can backfire, stoking a vicious cycle of hatred, the team at Duke University and the University of California, Berkeley, argued.

“Although elected officials routinely promote counterterrorism policies that target Muslims more than other groups, our findings indicate that these policies may make communities more vulnerable to radicalization if they are interpreted as discriminatory or unfair,” sociologist Christopher Bail and colleagues wrote in their report published in Science Advances.

They used an unusual approach — combing through internet search terms to assess what people are thinking about. That’s because just asking people if they are planning to become terrorists doesn’t work, Bail’s team pointed out.

“Would-be extremists are unlikely to identify as such within public opinion surveys,” they wrote. And people with strong prejudices may not always admit to them.

They used publicly available data that Google provides as part of its AdWords service, as well as other search engine data. They cross-checked this with U.S. Census and other information on community makeup.

“For each county in the United States, we queried Google’s keyword planner for the average monthly search range of the following pro-ISIS phrases: ‘How to join ISIS,’ ‘How to join the Islamic State,’ ‘How to support ISIS,’ and ‘How to support the Islamic State’,” they wrote.

They also looked for anti-Muslim sentiments with search terms such as: “Muslims are terrorists,” “Muslims are bad,” “Muslims are dangerous,” and “Muslims are evil.”

In communities where anti-Muslim searches were common, searches about joining or supporting ISIS also went up, they found.

“We find that anti-Muslim searches are strongly associated with pro-ISIS searches — particularly in communities with high levels of poverty and ethnic homogeneity,” they wrote. Usually, in the U.S., this means communities where whites dominate and where ethnic minorities stand out, Bail said.

“These are places where a member of a minority group might be more likely to be visible and perhaps more likely to experience discrimination because of their isolation,” Bail told NBC News.

Bail wrote a book about radicalization — "Terrified: How Anti-Muslim Fringe Organizations Became Mainstream" — in which he documents the rise of anti-Muslim groups and their influence on public opinion.

“We can agree to disagree about whether Muslims present an imminent threat to America,” Bail said.

“But if our goal is to prevent further radicalization and if there is evidence that discrimination against Muslims might be driving radicalization, then I hope we can at least agree that very public attacks on Muslims should be carefully thought out,” he added.

“There may be very little benefit and there could be substantial cost.”

When he was running for office, Donald Trump called for barring all Muslims from entering the U.S., and as president, he has limited travel and immigration from Muslim-majority nations.

Bail and his team deliberately do not name the communities where they saw the greatest number of anti-Muslim and pro-ISIS searches.

“We have concerns the Muslim communities, particularly those in which there are very few Muslim families, could experience negative reactions to this work and could perhaps be targeted for discrimination or worse,” Bail said.

There’s much evidence that better assimilation does work to keep the U.S. safe, he added.

“Historically, Muslim Americans have been very well integrated into American society, occupying upper-middle-class demographics, highly educated and, generally speaking, not clustered into communities,” he said.

Parts of Europe have much more segregation, he noted, and also higher rates of radical attacks.

“Ethnic diversity is, to some degree, protective against radicalization because people are less likely to think of the world in binary terms such as ‘us’ versus ‘them,’” he said.

Bail agrees with groups such as the Council on American-Islamic Relations, as well as some law enforcement officials, who say Muslim Americans are becoming reluctant to cooperate with the federal government and may stop providing crucial tips about potential terrorists.

“As recently as 2010, the Muslim community was the second-leading source of tips in counterterrorism investigations,” Bail said.

“The important question now is to what extent will anti-Muslim sentiments drive our policies and to what extent will that make it harder for Muslim Americans to feel secure and supported in working with law enforcement and intelligence communities.”