Europe faces a "populist uprising" if it is unable to show people it can control the migrant crisis, former MI6 head Sir Richard Dearlove has said.
He was speaking on the BBC's World on the Move day on migration issues.
Sir Richard also warned against offering visa-free travel to Turkish nationals, describing the move as like storing gasoline near a fire.
Earlier, UN special envoy Angelina Jolie Pitt warned the humanitarian system for refugees was breaking down.
She spoke of a "fear of migration" and a "race to the bottom" as countries competed to be the toughest to protect themselves.
BBC News World On The Move is a day of coverage dedicated to migration, and the effect it is having on our world.
A range of speakers, including the UNHCR's special envoy Angelina Jolie Pitt, and former British secret intelligence chief Sir Richard Dearlove, have been setting out the most important new ideas shaping our thinking on economic development, security and humanitarian assistance.
Sir Richard said the numbers of immigrants coming into Europe over the next five years could run into millions.
The crisis could reshape the continent's geopolitical landscape, he said.
"If Europe cannot act together to persuade a significant majority of its citizens that it can gain control of its migratory crisis then the EU will find itself at the mercy of a populist uprising, which is already stirring," he added.
He described the UK referendum on leaving the EU as "the first roll of the dice in a bigger geopolitical game".
Sir Richard warned against a deal with Turkey to allow visa-free travel to the EU to its citizens in exchange for controlling migration to the EU.
He said it was "perverse, like storing gasoline next to the fire we're trying to extinguish".
Talks between the Turkey and the EU over the deal have currently stalled over the former's refusal to amend its anti-terror laws.
The former head of MI6, which gathers intelligence abroad for the UK government, said €1.8bn (£1.4bn) allocated by the EU to address the root causes of migration in Africa made "much more sense" than a deal with Turkey but was not nearly enough.
The only answer was a "massive response" of this kind combined with a "much more aggressive operation along the North African coast", he added.
But Sir Richard cautioned against shutting the door on migration altogether.
"In the real world there are no miraculous James Bond-style solutions," he said. "Human tides are irresistible unless the gravitational pull that causes them is removed."
Speaking earlier in the day, Ms Jolie Pitt said that more than 60 million people - one in 122 - were displaced globally - more than at any time in the past 70 years.
"This tells us something deeply worrying about the peace and security of the world," she said, adding: "The average time a person will be displaced is now nearly 20 years."
Ms Jolie Pitt said the "number of conflicts and scale of displacement had grown so large" the system to protect and return refugees was not working.
Child refugees need 'new deal' - Lyse Doucet, BBC chief international correspondent
Save the Children is calling for greater international commitment to ensure child refugees remain in school.
The charity's new report, A New Deal for Refugees, says only one in four refugee children is now enrolled in secondary school.
It is calling on governments and aid agencies to adopt a new policy framework that will ensure no refugee child remains out of school for more than a month.
It is an ambitious target but there is growing concern that this migration crisis is producing a lost generation of children which means conditions for even greater insecurity and poverty.
A note on terminology: The BBC uses the term migrant to refer to all people on the move who have yet to complete the legal process of claiming asylum. This group includes people fleeing war-torn countries such as Syria, who are likely to be granted refugee status, as well as people who are seeking jobs and better lives, who governments are likely to rule are economic migrants.