Birmingham City Council is facing a knotty problem after failing to overturn a court ruling that its housing policy unlawfully favours one homeless group over another.

The council's QC, Ashley Underwood, denied it acted unreasonably by leaving six families on its waiting list - in some cases for years - although they had been classified as homeless because their living conditions were overcrowded or otherwise inadequate.

He told top judges that, to find new homes straight away for families or individuals as soon as their housing is labelled inappropriate, would have "dramatic financial consequences" and place an impossible strain on the city's housing resources.

But Lord Justice Ward, who yesterday upheld a High Court decision that the council's waiting list policy is unlawful, said Birmingham had adopted an allocation policy which "gave preference to the street roofless above the homeless at home".

If that placed an unreasonable burden on Birmingham and other local authorities, he added, then it was for Parliament, and not the courts, to change the law if necessary.

He pointed out that the council had gone for a drastic solution when faced with an overwhelming housing problem. Birmingham is the largest local authority in the country, he said, with nearly 20,000 waiting for housing.

Mr Underwood claimed the High Court judge wrongly found that the policy unfairly distinguished between "those who were homeless at home and those who were in temporary accommodation provided by the council".

The council went to the Appeal Court, challenging a ruling by High Court judge, Mr Justice Collins, who said in January last year that the city's waiting list policy might amount to a violation of human rights in some of the worst cases.

The judge refused to rule out compensation claims under the Human Rights Act against the council by those who have suffered the most.

In each of the six cases - one of them involving a widow and her seven children living for over six years in a damp, mould and rat-infested property - the judge concluded the council had failed in its Housing Act duty to provide "suitable" accommodation.

But Mr Underwood told the Appeal Court it was a "false premise" to say that the council could not leave families in their current accommodation pending suitable, long-term, homes being found for them. He said that, if Mr Justice Collins' ruling was correct, the council would be under a legal duty to relocate occupants "forthwith" if their housing was found to be unsuitable.

Doing so would have a drastic impact on the City Council's finances, he argued. Lord Justice Ward, sitting with Lady Justice Arden and Lady Justice Smith, sympathised with the city council's housing dilemma, but he concluded: "If the fulfilment of this duty is proving impossible, it is for the legislature to consider whether their position can be ameliorated."