A Suffolk Superior Court Judge Thursday struck down a controversial deal that would allow Partners Healthcare to add three hospitals to its already expansive statewide network.

The deal — years in the making — was architected by former Attorney General Martha Coakley and Partners HealthCare, who were seeking to add South Shore Hospital and two north shore hospitals to its network. The complex agreement would have allowed the acquisitions to proceed, provided Partners agreed to a series of conditions, including caps on prices. It was rejected by a judge Thursday evening.

"Finally someone has been willing to say — publicly and with authority — that Partners has no clothes," said Alan Sager, a professor of health policy and management at the Boston University School of Public Health. He’s been critical of the deal — and Partners' growth — from the start. He says the reason is simple: It stifles competition.

"I don’t think it’s really possible to get a competitive free market in health care, but in the world that we live more competition will mean lower prices," Sager said.

Despite the conditions of the deal, and assertions from Partners that it would help drive down costs, it was the concerns about lack of competition that landed the deal in Judge Janet Sanders court. After months of hearings, and an extensive public comment period, the judge said in November that she would delay a ruling until new Attorney General Maura Healey took office. Earlier this week, Healy came out against the deal. In a 48-page decision, Sanders has now done the same.

In a statement to colleagues, Partners CEO Gary Gottlieb expressed disappointment that the judge struck down a deal that he said would deliver “high-quality care closer to home for patients and their families in a lower cost community-based setting.” Others hailed Sanders decision.

"Candidly, I think the public was well served," said David Spackman, general counsel for Lahey Health, a member of a coalition of area hospitals who fought vigorously to stop the deal.

"We’re happy with the process, we’re happy the issue got publicly debated, that transparency was throughout and the ultimate decision, yes, we believe was the right decision," Spackman said.

Partners can continue to pursue the acquisitions, but according to the attorney general’s office, they would now do so under the threat of litigation.