The de Blasio administration and some Brooklyn residents appear close to an agreement to open a controversial men's homeless shelter in Crown Heights. The project has been tied up in court for weeks and could prove to be a crucial test for the mayor's new homeless shelter plan. NY1's Courtney Gross filed the following report.

A number of Crown Heights residents were determined to prevent a proposed homeless shelter from opening.

But on Monday, it looked like they were not going to be successful.

"It's just disappointing that the city wouldn't go somewhere else, knowing this area is already oversaturated," said Fior Ortiz-Joyner of the Rebirth of Bergen Street Block Association.

Some Crown Heights residents and the city are nearing an agreement to open a 104-bed homeless shelter for men.

For almost two months, it has been tied up in court. Residents sued, arguing their neighborhood already had its fair share of shelters.

"A lot of the things we asked for were declined," Ortiz-Joyner said. "So right now we are basically being pushed to take what the city is offering."

A state court judge had urged both parties to come to an agreement on their own. Monday, it became clear the judge was highly unlikely to block the shelter's opening.

Instead, the court will most likely order the city to provide certain security measures for the community, like bike patrols several times a day and security cameras — things that the city had already planned to do.

A formal ruling is expected Wednesday. Attorneys would not discuss the details of the possible agreement outside of court.

"I am not at liberty to say what we are negotiating as of this point, but, as you know, there are many issues in this case and the judge is addressing them," said Jacqueline McMickens, the attorney for the plaintiffs.

"We remain confident the court will recognize our vital need for these high-quality beds, as they have for decades in these kinds of cases," the city's Department of Homeless Services responded in a statement.

While the outcome looks good for the city, it is still the first test of the mayor's new homeless plan. He hopes to open up 90 new homeless shelters over the next five years.

Controversial, indeed, and even one of the mayor's political rivals showed up in court.

"He's ramming this down their throat," said mayor candidate Sal Albanese. "These folks have a great argument, and I am here to support them."

Now the big question is, Does this case set some sort of precedent for other communities who want to fight a homeless shelter coming to their neighborhood?