The Scottish government is to end free university tuition for European Union students from next year.
It said that following the Brexit vote, continuing with this policy would significantly increase a risk of any legal challenge.
Higher Education Minister Richard Lochhead made the announcement in a statement to parliament.
He said it was with a "heavy heart" that they were taking this decision from 2021/22.
Figures suggest there are about 16,000 non-UK EU nationals enrolled in Scottish higher education.
Under EU law, the free tuition policy for students based in Scotland meant that EU citizens who came to study needed to be treated the same.
After the Brexit vote, ministers announced a continuation of the free tuition for EU citizens.
However, with the Brexit transition period expiring at the end of December, the Scottish government has said it must end the scheme.
EU students who have already started their studies, or who start this autumn, will not be affected and will still be tuition-free for the entirety of their course, the minister said.
Mr Lochhead also said that the money which currently pays for EU student fees, up to £19m a year, will be kept in the higher education sector and should lead to an increase in the number of students from Scotland getting a place at university.
The minister told MSPs it was the UK government that had turned its backs on Europe, not Scotland.
"That is the stark reality of Brexit and a painful reminder that our country's decisions are affected by UK policies that we do not support and did not vote for," he said.
Scottish Conservative education spokesman Jamie Greene welcomed the move to end free tuition for EU students and said it would provide "a much-needed cash boost for Scotland's universities".
Scottish Labour's Iain Gray said he was glad to hear the pledge to keep the money in colleges and universities but the failure to provide any new money was "very disappointing".
Meanwhile, the Higher Education Minister also told MSPs that the challenges of Covid-19 and Brexit presented a "double-whammy" for universities.
Most colleges and universities are planning a phased return to on-campus learning after the summer as part of a blended model with remote teaching.
Mr Lochhead said the Scottish government was looking at whether the two-metre social-distancing rule could be reduced in certain circumstances in colleges and universities when the new term starts.
He said he would provide an update soon.