Risk to public finances.
Leaving the EU and ending freedom of movement could cost Scotland £2 billion in tax revenues, External Affairs Secretary Fiona Hyslop has warned.
Each EU citizen coming to live and work in Scotland contributes, on average, £10,400 per year in tax.
The UK Government's proposed Brexit deal is expected to halve the number of people from EU27 countries migrating to Scotland, meaning £2 billion less by 2040 to spend on vital public services such as the NHS and schools.
Ms Hyslop said:
"People from other EU countries bring huge economic and social benefits to Scotland. However, the UK Government's Brexit deal to end freedom of movement fails to take into account our distinct needs and now risks a worrying £2 billion cost to Scotland's tax revenues.
"With all of Scotland's population growth over the next 25 years predicted to come from migration, EU freedom of movement is vital for our nation's future prosperity and essential public serves, such as schools and hospitals.
"It is clearly in Scotland's best interests to stay in the EU or, if that is not possible, the European Single Market and Customs Union. Equally, the Scottish Government should have devolved responsibility for migration so we can have a migration policy tailored to Scotland's needs."
Scotland's Place in Europe: People, Jobs and Investment demonstrated continued migration from the EU in line with freedom of movement is required to support continued economic growth, with each additional EU citizen working in Scotland currently contributing an average of £10,400 in tax revenue.
Analysis shows there would be a 4.7% (£2 billion) reduction in Scotland's revenue by 2040 under the 50% reduction in EU migration population projected following Brexit.
In 2017 evidence submitted to the UK's Migration Advisory Committee (MAC) by the Scottish Government confirmed that EU nationals working in Scotland contribute an average of £34,400 each to Gross Domestic Product (GDP) - more than £4.4 billion a year.