Chancellor Angela Merkel said on Wednesday refugees had not brought terrorism to Germany, adding that Islam belonged in the country as long as it was practiced in a way that respected the constitution.
More than a million people fleeing war and poverty in the Middle East, Africa and elsewhere arrived in Germany last year. The mood towards them has soured after a spate of attacks on civilians last month, including three carried out by migrants.
Two of those attacks were claimed by the Islamic State militant group.
"The phenomenon of Islamist terrorism, of IS, is not a phenomenon that came to us with the refugees," Merkel said at an election campaign event for her Christian Democrats in the eastern state of Mecklenburg-Vorpommern ahead of a regional vote on Sept. 4.
Merkel said many people had traveled from Germany to Syria for training with Islamist militants. In June Interior Minister Thomas de Maiziere said a total of more than 800 were believed to have gone to Syria and Iraq.
"This group has worried us for several years," she said at the event in Neustrelitz, a town 100 km (60 miles) north of Berlin.
Merkel's popularity has suffered in the wake of the attacks and 52 percent of Germans think her migrant policy is bad, a poll published last week showed.
The influx of migrants, many of whom are Muslim, has boosted support for the anti-immigrant Alternative for Germany (AfD), which is expected to perform well in elections in Mecklenburg-Vorpommern and Berlin.
"We have said clearly that an Islam that works and lives on the basis of the constitution ... belongs to Germany," Merkel said.
She added that a type of Islam that did not stick to the constitution or accept equal rights for women had no place in the country.