Hundreds of migrants were illegally detained at immigration removal centres, according to Home Office emails obtained by BBC News.
The detention centres were used to hold about 450 people - described in one email as "overflow" from the migrant processing facility at Manston.
The email said their detention was "no longer legal," adding: "We need to move them to hotels ASAP."
The Home Office said an unprecedented number of small boat arrivals had put "huge pressure" on the asylum system.
It said it had "worked tirelessly to move people into hotels or other accommodation as quickly as possible".
The email was sent on 4 November, the day after Home Secretary Suella Braverman visited Manston amid pressure to get a grip on overcrowding at the site.
According to a chain of emails, obtained under the Freedom of Information Act, the Home Office permanent secretaries - the department's most senior civil servants - were made aware of the concerns at the time.
Shadow home secretary Yvette Cooper said the emails "demonstrate the Home Office knew that they were breaking the law and lay bare how their chaotic failure to plan led to this situation".
"Under [Ms Braverman's] direction the Home Office has lost control of the system and has created potential substantial legal costs for the taxpayer."
The Home Office site in Kent was intended to hold migrants for 24 hours, but some were detained there for weeks
In October, it was revealed about 4,000 people were being held in tents at Manston, leading to overcrowding and disease.
By early November, between 450 and 500 asylum seekers had been moved to immigration removal centres as "Manston 'overflow'", according to Home Office emails.
"Their detention is no longer legal as they can only be detained whilst their identity is locked down and then only for a maximum of 5 days," one email read.
"Most have been there for a number of weeks, longer than some Manston cases. We need to move them to hotels ASAP…"
Manston was designed to quickly process and release migrants who arrive in the UK in small boats.
But inspectors have raised concerns about the number of people being held for long periods in "cramped and uncomfortable conditions, often supervised by staff who have not been suitably trained".
The home secretary is due to be questioned by a House of Lords committee on Wednesday about asylum accommodation and the backlog of unprocessed claims.
One man, who was held in Manston for 24 days, claims he was attacked by an official after what detainees described as a peaceful protest. Kent Police are investigating the allegations.
BBC News has obtained photos taken by staff at the centre that show the man with a blood-stained face and swollen nose.
After the protest was broken up by Home Office staff on 27 October, he said he was held around the neck by an official, and used "whatever strength I had to remove his arm from choking me".
"When I removed his hands, he pushed me and I fell backwards onto someone else. While I was on the floor, the same officer grabbed my head and used his knee to bash my head in and broke my nose. From this point onwards, I lost consciousness."
Pictures taken by staff at Manston show the man's face and hands covered in blood
The BBC has spoken to five other detainees who said they witnessed the alleged assault and corroborate the man's claims.
The Home Office said the allegations did not match its understanding of events.
"There is an ongoing investigation to establish what happened on this occasion and it would be inappropriate for us to comment further," it said.