Chancellor Angela Merkel has dismissed suggestions that the influx of refugees over the past year brought Islamic extremism to Germany.
Mrs Merkel said that "the phenomenon of Islamist terrorism by IS isn't a phenomenon that came to us with the refugees, it's one that we had before too".
She conceded, however, "it can be seen that there are attempts to win over refugees (for terrorism), or we had the case of Paris, where refugees were deliberately smuggled in by IS".
Mrs Merkel was speaking at a campaign event in the north-eastern state of Mecklenburg-Western Pomerania, where her Christian Democrats face strong competition from the nationalist, anti-immigration Alternative for Germany party in state elections on September 4.
The country was shaken by a string of attacks in July, two of which were the first in Germany claimed by Islamic State (IS). In those, only the attackers - both asylum seekers - were killed. In an unrelated attack, a German teenager killed nine people in Munich.
Last week, Germany's interior minister unveiled proposals to boost security - among them creating several thousand jobs with federal security services, making it easier to deport foreigners deemed dangerous and stripping dual nationals who fight for extremist groups of their German citizenship.
"I can understand that security has very, very high significance for people at the moment, that's completely clear," Mrs Merkel said in a video released by her party. "We are doing everything humanly possible to ensure security ... and wherever gaps arise, we must readjust and consider new variations of security."
Mrs Merkel said it is important to prevent people-smuggling and ensure that refugees can live in "humane conditions" near their homelands - for example, through arrangements such as the European Union's deal with Turkey to cut migrant flows.
"There won't be another way if we want to reduce the number of people coming to us and if we consider the fate of people who can often live better near their homeland, their cultural homeland, than if they come over 1,000 kilometres (620 miles) to us," she said.