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.
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.
Sir Richard said the numbers of migrants and refugees 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" and said the EU had been "hesitant" in its response to the crisis.
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 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 more than 60 million people globally, one in 122, were displaced - 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.