ROCKY HILL — A Superior Court judge has dealt a devastating setback to efforts by Rocky Hill to prevent a state-backed nursing home for inmates and mental patients from opening.

By dismissing the town's lawsuit against iCare Management LLC and its subsidiary, SecureCare Realty LLC, Judge Antonio C. Robaina removed the major legal stumbling block for the 95-bed facility at 60 West St.

Robaina ordered the dismissal Tuesday afternoon. Town Attorney Morris R. Borea said he received notification Tuesday evening. On Wednesday night, Borea communicated the news to a somber group of about two dozen neighborhood residents who have been meeting regularly since December.

Among the listeners was former Mayor Anthony LaRosa, who like others in attendance, was stunned to learn of the judge's action.

Nicole Crawford, a West Street resident and neighborhood leader, called the decision "an outrage. It's so unbelievable that a judge would just throw it out."

Crawford helped lead a petition drive and organized a rally outside the state Capitol in an attempt to persuade Gov. Dannel P. Malloy and top administrators to back away from the nursing home plan.

"It's like it was all for naught. Everyone has to play by the rules except for them," she said.

Another West Street resident, Tony Coco, who with his wife and two young children lives next to the nursing home property, said, "What can we do? We have to sit tight and put a fence around our home."

The court ruling short-circuited the town's efforts to obtain an injunction barring the nursing home from accepting patients. The town had argued that the home would operate as a type of prison, with patients kept under tight, private security and unable to leave the facility.

The facility constitutes a threat to public safety and is not allowed under local zoning, according to the town's lawsuit filed in December.

"I was totally shocked by the decision. At the worst, I thought he would give us a hearing and we'd do discovery," Borea said.

He said the town will appeal the ruling. A special meeting of the town council is scheduled Friday to authorize the appeal to the Connecticut Appellate Court.

Although the memorandum of decision has not been released, Borea said he expected that Robaina upheld the claim of sovereign immunity brought by Jonathan Starble, the attorney who represents iCare and SecureCare Realty.

Starble argued that his clients will operate the nursing home under a state contract as agents of the state, and should not be subject to a lawsuit or local interference. He had asked that the court rule on the validity of the suit before allowing pretrial discovery.

The sovereign immunity claim "opens up a Pandora's box,'' Borea said. It could effectively thwart lawsuits against the facility by individuals who sustain injuries on the property, or patients who do not receive proper care.

Also present at Wednesday evening's briefing were Sen. Paul Doyle, D-Wethersfield, and Rep. Antonio "Tony" Guerrera, co-sponsors of a bill that places restrictions on community nursing home placements of inmates and mental patients. The bill has been approved by both the public health and judiciary committees.

"We'll just keep fighting the fight,'' said Guerrera, an outspoken opponent of the plan who has urged the state to consider converting unused corrections buildings into long-term care facilities.

State officials say that by moving those patients who are terminally ill, or chronically ills and qualify for full-time nursing care into private facilities, they will become eligible for $5.5 million a year in federal Medicaid reimbursement.

In addition to its lawsuit against iCare Management and SecureCare Realty, the town filed suit against state Public Health Commissioner Jewel Mullen to block the facility's relicensing. That hurdle has also been now cleared, Borea conceded.

The state had hoped to start transferring patients in March, but the permit and inspection process has not been completed.

"They're putting up a fence all around the building and there are contractors there,'' Coco said.