The controversial Dungavel Immigration Removal Centre in Lanarkshire is to be closed, the Home Office has announced.
The centre, near Strathaven, is set to close towards the end of 2017.
The Home Office said it would look to build a new short-term holding facility near Glasgow Airport.
Dungavel opened in 2001 and can hold up to 249 detainees. It is the only such centre in Scotland and has been the subject of numerous protests, which branded the site "racist and inhumane".
What is Dungavel?
The Dungavel Immigration Removal Centre, which is housed around a 19th-century hunting lodge and summer retreat of the Duke of Hamilton, is a UK government facility for detaining refugees and failed asylum seekers prior to deportation.
Why is it controversial?
The conditions at the detention centre are often criticised by campaigners, with the detainees claiming they are treated like prisoners. There is also concern about the length of time people can be detained at the centre. For many years there were protests about children being detained at Dungavel but this was stopped in 2010.
UK Immigration Minister Robert Goodwill said: "We keep our detention estate under constant review to ensure we have the right resources in the right places.
"The new short-term holding facility would provide easy access to London airports, from where most removals take place, meaning those with no right to be in the UK can be removed with less delay.
"Closing Dungavel immigration removal centre as a consequence fits with that approach and will result in a significant saving for the public purse."
Plans for the new 51-bed centre on Abbotsinch Road, beside Glasgow Airport, need approval from Renfrewshire Council.
The Home Office said the "vast majority" of stays there would be for less than a week.
The Scottish government has welcomed the closure of Dungavel but questioned the purpose of the new facility in Renfrewshire.
Communities Secretary Angela Constance said: "The Scottish government has long campaigned for the replacement of Dungavel with a more humane system, however, by introducing a rapid removal facility there is a real risk that people who have been living in Scotland will either have their opportunities to challenge their deportation restricted or be taken to immigration removal centres far away from their families, friends and legal representation.
"This move could make it considerably more difficult for them to pursue their cases and have serious impacts on their mental health.
"We will be seeking urgent clarification from the UK government on their proposals and guarantees around the way in which asylum seekers based in Scotland facing deportation will be treated."
Dungavel, in South Lanarkshire, which is operated under contract to the Home Office by GEO Group Ltd, has been the subject of dozens of protests since it opened and has drawn widespread criticism from politicians and immigration campaigners.
More recently it has focused on the length of time detainees were held at the facility and the conditions inside.
Last year, the BBC revealed that dozens of failed asylum seekers had been held at Dungavel for months and in some cases more than a year.
This prompted a request from a delegation of trade union, religious and refugee groups to visit the centre to assesses the welfare of detainees.
When the request was declined by the Home Office, the delegation, led by the Scottish Trades Union Congress, said it was "disappointed" and "angry".
Concerns about the detention of vulnerable asylum seekers were also raised by Her Majesty's Inspectorate of Prisons in 2015.
The inspectorate found problems with reporting at Dungavel meant some vulnerable detainees were being held despite safeguards intended to prevent this. They included an alleged rape victim.
In May this year, hundreds of people, including former detainees, asylum seekers and refugees, surrounded the centre and called for its closure.
The protest, organised by pressure group, We Will Rise, branded Dungavel "racist and inhumane" and called for an end to detention of refugees and migrants.
The Home Office has consistently said that detention was part of a "firm but fair" system, of which Dungavel was an important part.
'Dignity and respect'
Green MSP Ross Greer said Dungavel's replacement in Renfrewshire should not be a carbon copy.
"The closure will be welcomed by the thousands of people traumatised by their treatment in the prison, who were held against their will in spite of not committing a crime," he said.
"The new facility is an opportunity for the UK government to begin treating these vulnerable people with some dignity and respect."
Human rights lawyer Aamer Anwar, who has represented families detained at Dungavel, called the closure "long overdue".
He urged the Scottish government to seek guarantees that there will be "rigorous and independent accountability" of the new short-term facility.
Robina Qureshi, director of the refugee and migrant homelessness charity Positive Action in Housing, said: "We say good riddance to Dungavel, which was nothing more than a scar imposed by the Westminster government on Scottish soil."
She added: "We remain concerned about what happens next. A short-term holding facility will be built at Glasgow airport making it easier to remove people to London airports from where most removals take place.
"It will be harder for lawyers and support networks to organise appeals at the eleventh hour."