French President François Hollande, center, speaks with Slovakian Prime Minister Robert Fico, right, while flanked by Lithuanian President Dalia Grybauskaite during a European Union summit to discuss Syria, relations with Russia, trade and migration on Thursday in Brussels. (Stephane de Sakutin/AFP via Getty Images)

A long-awaited offensive to dislodge the Islamic State from its stronghold city of Mosul is fueling fears of renewed terrorist attacks, as European counterterrorism officials say more fighters are returning home after waging jihad in Syria and Iraq.

The security concerns are a major focus of European intelligence agencies as the Iraqi army and its partners press the assault on Mosul, which the Islamic State has used as a capital for planning and operations for more than two years. Attacks in Paris and Brussels in recent years have been conducted by locally born attackers who in some cases trained with the Islamic State in Iraq and Syria, then returned home.

The threat underlines a central dilemma facing leaders of nations where the Islamic State has carried out terrorist attacks: Even as they support efforts to defeat the group on the ground, they risk dislodging its adherents and casting them elsewhere. Top officials say that they are raising their vigilance as thousands of people stream out of Mosul, which is under heavy bombardment in the largest operation for Iraqi security forces since they were formed after toppling Saddam Hussein.

Counterterrorism officials say it is too early to know whether the Mosul operation will spark a new wave of fighters coming back to Europe. But they say that when the Islamic State has been dealt battlefield blows in the past year, more of its adherents have returned home.

“Further military losses, further military pressure on them in the region, indeed might lead to an increased reflex response by the group in Europe,” said Rob Wainwright, the head of Europol, the Pan-European policing agency that is coordinating efforts to combat the group inside European Union borders. Flows of returning fighters have “slightly increased” in recent months, he said. “Not yet in high numbers. Maybe Mosul and Raqqa could change that,” he said, referring to the Islamic State’s Syrian stronghold, which is the next major target after Mosul.

Between 4,000 and 5,000 European residents are estimated to have gone to Syria and Iraq to take part in the fight, which has raged since Arab Spring protests in Syria in 2011. A majority of the European fighters are said to be on the ground there, Wainwright said. About a third is estimated to have returned, with the remainder killed.

The trip has been made harder by Turkey’s sealing of its border with Syria, a step that has significantly cut down on traffic in both directions. Turkish officials have said in recent days that they view fleeing Islamic State fighters as a significant domestic threat and that they are committed to bolstering security along the long border with Syria and Iraq. The Islamic State also has been known to kill disillusioned fighters who try to abandon the fight, further reducing return movement.

The group may also seek to pull off high-profile attacks as a way of proving its continued relevance. The flow of new European recruits to the fight has slowed to a trickle this year after posing a major challenge to authorities in recent years.

Still, some movement is possible, Wainwright said.

“ISIL are in the business of getting their people back into Europe in increasingly sophisticated ways,” he said, including paying organized crime groups for high-quality fake travel documents. In recent months, there has been “some pickup in the rate of return,” most noticeably to Britain, Sweden and Italy, he said.

E.U. counterterrorism officials have been warning for months that a string of setbacks for the Islamic State inside the territory it controls could create a threat as its supporters flee and as its leaders seek to prove their ongoing relevance. Repeated attacks on Paris last year, then the March attacks in Brussels, were the first warning sign of the group’s new focus on Europe. Then this summer, a spate of Islamic State-inspired attacks that began on Bastille Day in Nice, France, showed just how little resources were necessary to perpetrate large-scale killings.

“We have to be prepared, that’s the point. It’s a lot of people,” E.U. Counterterrorism Coordinator Gilles de Kerchove said. “We don’t know whether it will be a massive return or whether it will be over a long period of time.”

Even if the group is forced to retreat significantly on the ground, he said he doubted the danger would evaporate for Europe.

“They’ve shown agility in the past. I suspect those who were not killed or captured will try to reinvent it,” de Kerchove said. One fear, he said, was that European citizens could take skills learned on the battlefield and apply them at home — a possibility that could encompass everything from chemical weapons to car bombs.

The complex threat has European officials carefully monitoring the offensive, which was launched Monday by Iraqi and Kurdish forces with Western air and ground support.

“Hundreds of thousands, if not a million” people might try to flee Mosul, French Foreign Minister Jean-Marc Ayrault said Thursday, adding that security forces need to check them all to make sure that Islamic State fighters are not escaping by blending into the crowds. He spoke after a conference in Paris devoted to the battle.

For now, the most immediate security concerns related to Mosul have to do with the protection of civilians in the city, which is said to have up to 1.5 million residents. The Islamic State has in the past used civilians as human shields, and any form of urban combat poses a challenge in separating civilian from fighter. If Islamic State combatants flee anywhere at all, the obvious first step is Raqqa, the group’s bastion in neighboring Syria. Anti-Islamic State forces have declared that their next target.

Iraqi officials have warned Western leaders that while Iraq and Syria might be on the front line, the threat is also potent in Europe.

“It is your enemy just as much as ours. It is a challenge for you as it is for us. And Daesh is trying to operate in your capitals, just as it is trying to operate in our capital,” Iraqi Foreign Minister Ibrahim al-Jafari told the European Parliament on Wednesday, using another name for the Islamic State, which is also known as ISIS and ISIL.

The deteriorating security situation in the Sinai region of Egypt and ongoing chaos in Libya provide a different escape route for Islamic State fighters, analysts say. Militants could either stay in those areas, further destabilizing an already volatile situation, or they could join the migrant flow northward across the Mediterranean into Italy. That route for migrants and asylum seekers has continued largely unimpeded this year even as traffic into Europe from the Western Balkans has halted because of a March deal with Turkey.

Counterterrorism analysts say that even if the Islamic State is dealt a major battlefield defeat, it would probably hold on to its ability to sow chaos across the region.

“It is in the nature of these groups to find a way to bounce back,” said Mohammad-Mahmoud Ould Mohamedou, deputy director of the Geneva Center for Security Policy.

“What better way to indicate that they’re not losing ground than to stage a really spectacular operation?”

Annabell Van den Berghe contributed to this report.