Inspectors branded the Pembrokeshire site “unsuitable” and asylum seekers said it was a Covid risk.
An Army camp housing asylum seekers in Pembrokeshire is set to close within days, a UK government minister says.
It comes after inspectors said the camp at Penally and Napier Barracks in Kent were “run-down and unsuitable“.
The Home Office said it gave “safe and secure accommodation for asylum seekers who would otherwise be destitute”.
Welsh Secretary Simon Hart said the Home Office had agreed to return Penally to the Ministry of Defence by 21 March.
BBC Wales has been told the remaining asylum seekers will be gradually moved out before then.
The Home Office decided to house up to 250 asylum seekers at Penally from September last year.
But some people housed at the camp claimed the conditions were unsafe and it had put them at risk of coronavirus.
Video footage and photographs of the camp, seen by BBC Wales, appeared to show bathroom floors covered with water, every toilet in one bathroom blocked, and beds in communal rooms positioned less than 2m (6ft) apart.
However, the Home Office had said it was safe and “Covid-compliant”.
It also attracted protests from people living in the area and complaints about costs incurred by Pembrokeshire council and Dyfed-Powys Police.
In a letter to local residents, Mr Hart said he was “deeply conscious” that the manner in which the use of Penally for asylum seekers had come about “caused much frustration and anger”.
He said while the Home Office recognised this, it stressed it “had little option at the time”.
The Welsh Labour government and Plaid Cymru had previously called for the camp to be closed.
Plaid Cymru Westminster leader Liz Saville Roberts MP claimed it was “thanks to the hard work of Plaid Cymru police and crime commissioner Dafydd Llywelyn and councillor Jon Preston that the Home Office finally bowed to pressure and agreed to close the camp – but it should have never come to this”.
She added: “The institutional failures of the Home Office over Penally camp are a scandal that must not be brushed under the carpet. We now need binding guarantees that a situation like this can never happen again.
“We need an asylum system that puts the welfare of those seeking asylum first, and for communities to be at the heart of decision making.”
Mr Llywelyn added: “The Home Office’s use of the camp, especially during a global pandemic, has put immense strain on local people, services and the residents themselves.
Naomi Phillips, director of policy and advocacy at the British Red Cross, said military barracks were “completely inappropriate and inhumane as housing for people fleeing war, persecution and violence”.
The Joint Council for the Welfare of Immigrants called the closure “amazing news” and said the Home Office now “must shut Napier barracks too”.
“No-one should have been placed in these inhumane Covid traps in the first place,” it added.
The Home Office said Penally “provided emergency capacity in response to pressures put on the asylum estate during Covid”.
It added: “As those pressures have eased we have decided not to extend emergency planning permission beyond six months. Napier will remain in operation in accordance with current needs.
“The home secretary will soon bring forward her plan to fix our broken asylum system and that plan will address the government’s asylum estate.”
The BBC is not responsible for the content of external sites.