An asylum seeker who was beaten up twice in Swansea has been told he must move back to the city if he wants a council home for his family.
Mohamed Danesh said he had no choice but to return to Swansea
Mohamed Danesh moved to London in 2004 because he said it was too violent and racist for him to live there in safety.
But Kensington and Chelsea Council said his links were with Swansea.
The appeal court has backed the London council. Judges said the attacks on Mr Danesh were "random" incidents and were not because he was an asylum seeker.
Mr Danesh said he would have no choice but to live in Swansea following the ruling, even though he considers to be such a violent and racist place that he never wants to see it again.
The court heard Mr Danesh, who arrived in the UK with his family in August 1993 and at first went to Barnsley, had been in council accommodation in Geirol Road, Townhill, in Swansea.
Mr Danesh claimed his life was made a misery by local troublemakers. He said he had been asked if he was member of al-Qaeda, while on another occasion someone on a bus refused to sit next to him because of his colour.
In January 2004, he was pushed from behind outside Townhill Community Centre and was taken to hospital because of his injuries, and in June 2004 was mugged in Swansea town centre.
The appeal court was told Mr Danesh and his family were given emergency accommodation by the Royal Borough of Kensington and Chelsea after he moved to the area from Swansea.
But, after reviewing the case, the council said Swansea was the only local authority which could house him.
Mr Danesh had the council's decision overruled at Shoreditch County Court in March.
At that hearing, Judge Cotran decided Kensington and Chelsea should have taken into account Mr Danesh's fear of violence rather than the risk of him actually being harmed.
However that ruling was overruled at the appeal court on Friday.
Lord Justice Neuberger, sitting with Lord Justice Mummery and Lord Justice Jacob, said Judge Cotran was "plainly wrong" and his decision "wholly misconceived".
The judge added that, although Mr Danesh had been attacked twice, neither appeared to be related to his status as an asylum seeker and were "random" incidents that could have occurred anywhere in the country.
He added that, under a strict test in the Housing Act 1996, there has to be a real danger of someone suffering a physical assault because of their specific link to an area for them to be able to win their case.
The test is commonly used in cases of domestic violence, where sending someone back to their old neighbourhood may lead to them being attacked again by a violent spouse or partner.