Sweden's former Prime Minister Carl Bildt says the European Union would be "a more dangerous" place if the UK decides to leave.
Speaking to BBC Newsnight, Mr Bildt said "friends must stay together" and the EU could start to "fracture" if the UK leaves.
The UK would not be able to access the single market, unless it also retains freedom of movement in the EU, he said.
The UK referendum on membership of the EU is due by the end of 2017.
A UK vote to leave the European Union would result in a "very, very messy separation", he said.
Asked if the UK would be able to stay in the single market, but be able to restrict movement of people, he said did not see that as a viable possibility.
He said the EU would "lose credibility" if the UK leaves and urged the country not to get "bogged down in its own contradictions".
"We are living in a more dangerous world," he said.
"That means friends must stay together. If you suddenly see a Europe that starts to fracture with a significant country leaving, that is going to be a weaker Europe - and in my opinion a more dangerous Europe for everyone."
Borders and barbed wire
Mr Bildt was prime minister of Sweden from 1991-1994 and then foreign minister from 2006-2014.
He said his own country was "too far ahead" of the rest of Europe in terms of the numbers of refugees it has taken as a result of the migrant crisis.
"We need to calm down the numbers in Sweden somewhat... Over time we need to move to a truly common asylum system."
Europe had been "surprised by the magnitude of the meltdown in the Middle East", he said.
"We did not have sufficient control of our external borders in the Schengen system - that must be restored. That was a security issue."
But he said he found discussion in the UK around border control "somewhat bizarre".
"When you go past Calais and go into the tunnel, there is barbed wire," he said.
"The French are protecting the external border of the United Kingdom now... It looks like you have control of the external border today."
The full interview with Carl Bildt will be on BBC Newsnight on BBC Two on Wednesday 27 January at 22:30 GMT - or you can catch up afterwards on iPlayer