Asylum seekers are due to be removed from an Essex hotel after a council was granted a temporary High Court injunction blocking them from being housed there.
The injunction was sought by Epping Forest District Council to stop migrants being placed at The Bell Hotel in Epping, which is owned by Somani Hotels Limited.
Thousands of people have protested near the hotel in recent weeks after an asylum seeker living there was charged with sexually assaulting a 14-year-old girl in the town.
Mr Justice Eyre made his judgement after refusing an 11th hour effort from Home Secretary Yvette Cooper to get the council's case dismissed.
All asylum seekers must be moved out of the hotel by 16:00 BST on 12 September, the judge ruled.
The Home Office had warned the decision would "substantially impact" its ability to house asylum seekers in hotels across the UK.
But Conservative council leader Chris Whitbread said repeated protests in Epping were escalating tensions in the community and risked causing "irreparable harm".
Sixteen people have been charged with offences relating to disturbances during several protests, which sparked counter-demonstrations in support of migrants, which Essex Police said became violent on occasion.
Representing the council, Philip Coppel KC said the situation was "causing great local anxiety".