NEW YORK - After weeks of fighting in court, a state judge said the city can move more than 200 homeless men from the Lucerne Hotel on the Upper West Side to another hotel downtown in what is a clear victory for the de Blasio administration.

The decision means the homeless men, who have been staying in the Lucerne Hotel since July, will be moved downtown to a Radisson Hotel on William Street. A source told NY1 the group that tried to prevent the move, Downtown New Yorkers, will file an immediate appeal. They were hoping to be in court on Wednesday afternoon.

For weeks, attorneys have been fighting in state court over whether about 235 men from the Lucerne Hotel should be moved downtown. The de Blasio administration announced the men would be moved in September after residents on the Upper West Side complained for weeks about their quality of life deteriorating. Those Upper West Side residents claimed they witnessed open air drug sales, fights and public lewdness because of the men.

Those residents threatened a lawsuit, so the mayor said he would move them downtown.

That created another firestorm in Lower Manhattan, where residents also did not want the men to be housed. So, they took the city to court. Three men from the Lucerne piled onto that lawsuit — claiming they would be irreparably harmed if they were forced to move downtown from the Upper West Side.

In her highly anticipated decision Wednesday, Manhattan Supreme Court Judge Debra James dismissed the case outright, stating the Lower Manhattan residents lacked "standing to challenge the relocation of residents from the Lucerne Hotel to the Radisson Hotel.”

She also said the men from the Lucerne did not have a case.

Her decision stated: “… The intervening residents have no right to choose their own temporary placements. Thus, such parties have no grievance that is ripe for review, having suffered no harm cognizable under the law, and this court lacks subject matter jurisdiction and the intervening parties' premature pleadings must be dismissed.”

The city welcomed the ruling. 

"We're pleased with the Court’s decision, which will allow the City to continue providing critical services to those who need it most in the way we believe is most effective," a spokesperson for the city’s law department said in a statement.

The city is expected to move the men out of the Lucerne after the holiday.

Upper West Side residents who had pushed for the move were also satisfied with the decision on Wednesday. 

"We are very grateful to receive today's decision," their attorney, former Deputy Mayor Randy Mastro, said in a statement. "The Court recognized what we have been saying all along -- that the City made the right decision here, acting well within is discretionary legal authority, to move this vulnerable population from an SRO hotel on the Upper West Side to a better, safer facility downtown where each of these men will get their own rooms, receive more services, and have ample recreational space. It's a 'win-win' for all concerned, and now, it should go forward without any further delay. And on a personal note,  I hope those who have so personalized this dispute in their zeal to try to keep these men at the Lucerne will accept this decision as the final word and end this sorry chapter for the good of all concerned.”

Of course, not everyone saw it as a “good” decision. 

Shams DaBaron, one resident of the Lucerne who has become a pseudo-spokesman for the men, said: "We are hurt. This decision negatively affects homeless people throughout America and that's really what this fight was about: having our voices heard, challenging an irrational decision made by the Mayor to please some rich folk.”

Observers told NY1 the decision was bittersweet. While some did not want to see the men moved from the Lucerne, a decision in favor of a community group looking to oust a shelter from its neighborhood could set a dangerous precedent — that precedent being wealthy residents can sue to keep a shelter from coming to their block.