French Prime Minister Manuel Valls has warned that Europe's migration crisis is putting the EU at grave risk.
Mr Valls told the BBC Europe could not take all the refugees fleeing what he called terrible wars in Iraq or Syria.
"Otherwise," he said, "our societies will be totally destabilised."
More than a million migrants, mostly refugees, arrived in Europe last year, many making perilous journeys. On Friday, at least 21 people were killed as their boats sank off Greek islands.
Mr Valls also said that France could extend its current state of emergency for "as long as is necessary" because of the threat from Islamic State (IS) jihadists, whom he called "Daesh".
"We will see if we extend it," he said. "We cannot live forever in a state of emergency."
The measures were introduced after the IS-led Paris attacks on 13 November and then extended for three months.
Mr Valls said the war against IS could last for a generation. "As long as the threat is there we must use all means at our disposal."
Mr Valls was speaking to Lyse Doucet, the BBC's chief international correspondent, at the World Economic Forum in Davos, Switzerland.
Europe, he said, needed to take urgent action to control its external borders.
"If Europe is not capable of protecting its own borders, it's the very idea of Europe that will be questioned."
Asked about border controls inside Europe which many fear put the passport-free Schengen zone at great risk, Mr Valls said the concept of Europe itself was now in very grave danger.
He did not directly criticise Germany's Chancellor Angela Merkel for her welcoming message last year to refugees.
Mr Valls said she "had courage", but it was clear he believed her message was wrong, our correspondent says.
"A message that says 'Come, you will be welcome' provokes major shifts" in population, says Mr Valls.
Where Europe is failing on migrants
- The 28 member states have not agreed on an EU-wide mechanism for relocating migrants, meant to ease the burden on Greece and Italy. Only small groups have been relocated so far - and several states in Central and Eastern Europe refuse to accept migrants
- The Schengen agreement on freedom of movement is in jeopardy - Hungary fenced off its borders with Croatia, Serbia and Slovenia; some other Schengen countries have re-imposed border controls: Germany, Austria, Denmark, Sweden, France and Belgium
- The Dublin regulation is not working effectively - countries are no longer sending back migrants to their first point of entry to the EU
- Thousands of migrants - many of them Syrian war refugees - still arrive daily from Turkey
- Processing of asylum applications is slow and there is a big backlog - so reception centres are overcrowded
- Germany - the main destination for migrants - is rethinking its open-door policy, partly because of outrage over assaults on women in Cologne at New Year
He added: "We know clearly that after the Cologne incidents that with the continuous flow, not only to Germany but the countries of Northern Europe, Austria, the Balkans are confronted with this influx, that's why we need to find practical solutions for our borders."
Mr Valls was referring to attacks in the German city on New Year's Eve - largely attributed to foreigners - that have sparked 800 complaints, 520 of them relating to sexual crimes.
Mrs Merkel will later meet Turkish Prime Minister Ahmet Davutoglu in Berlin, with both the countries' cabinet members in attendance.
EU countries hope Turkey will help to control the flow of migrants reaching the EU from Syria and other conflict zones.
On Friday, at least 21 people, including eight children, died when two boats sank off the Greek islands of Farmakonisi and Kalolimnos, the Greek coastguard said.
Some 48 survivors reached shore but dozens of other migrants were reported missing.
On the issue of the state of emergency, Mr Valls said France was "at war", which meant "using all means in our democracy under the rule of law to protect French people".
The measure gives police more power to conduct raids and impose house arrests.
When asked how long he envisaged the state of emergency remaining, Mr Valls said: "The time necessary.
"As long as the threat is there, we must use all the means," he said, adding that it should stay in place "until we can get rid of Daesh", using an acronym for the IS group.
"In Africa, in the Middle East, in Asia we must eradicate, eliminate Daesh," he said. "It is a total and global war that we are facing with terrorism," he added. "The war we are conducting must also be total, global and ruthless."
Mr Valls said France "could see attacks again", adding that six plots had been foiled over the past few months.
Attackers linked to IS killed 130 people in co-ordinated assaults across Paris in November, leading to the first declaration of a state of emergency in France in 10 years.
The measures are set to expire on 26 February.
This week, a group of UN human rights experts said they were "excessive and disproportionate".