A Maryland judge ruled Thursday that the companies managing the Purple Line’s construction may quit over disputes with the state about $800 million in unpaid cost overruns, requiring transportation officials to find a new way to complete and pay for the megaproject.

The ruling allows for the unraveling of the Purple Line’s 36-year public-private partnership, one of the first on a U.S. light-rail project. It also would upend a major transit project designed to remake the auto-centric D.C. suburbs and attract economic development around the line’s 21 stations.

The decision does not preclude the Maryland Transit Administration (MTA) from trying to reach a settlement on the cost overruns to save the $5.6 billion partnership with Purple Line Transit Partners (PLTP), the concessionaire managing the construction. However, the court action followed more than three years of unsuccessful negotiations.

Maryland transit officials have said that the state will complete the light-rail line even if the companies leave but that doing so would add one to two years of further delays. The Purple Line, which would connect Montgomery and Prince George’s counties, was initially scheduled to begin carrying passengers in March 2022, but the contractor has said work is delayed by more than 2½ years.

Erin Henson, spokeswoman for the Maryland Department of Transportation, said the state remains committed to completing the project. She declined to say whether it will proceed with its lawsuit against PLTP alleging breach of contract.

“While we dispute PLTP’s right to terminate . . . [the state] will work with PLTP on an orderly transition,” Henson said in an email. “MDOT and MTA remain committed to both completing the project and protecting the state’s interests.”

A spokesman for Maryland Gov. Larry Hogan (R) referred questions to MDOT.

PLTP said it remains open to more negotiations with the MTA about the cost overruns “if the state chooses to engage in meaningful settlement discussions.”

“We remain convinced that a settlement is in the best interest of Montgomery and Prince George’s counties as well as the state because it will deliver the Purple Line sooner and at a lower cost than any possible alternative,” PLTP said in a statement.

Henson declined to say whether the state planned to resume negotiations.

The contractor’s project director testified in court that the firms could pack up and leave construction sites along the 16-mile alignment in two to four weeks. The sites would be left secured, he said. A lawyer for PLTP said ripped up roads would be repaved and any holes covered or filled.

Purple Line companies have filed notices with the state saying they would have to lay off 718 workers if they quit the project. However, the impact of any potential job losses remains unclear because Maryland officials also have notified about 170 subcontractors and suppliers that they are prepared to take over managing the line’s completion. State officials haven’t said whether the state will do that, hire a new construction contractor, or pursue another long-term public-private partnership.

In addition to delaying the project further, experts say, finding a new contractor or private partner would probably make it more expensive because new companies would have to assume more risk. The current construction contract is for $2 billion.

In two virtual hearings this week in Baltimore City Circuit Court, Maryland transit officials testified that they would have to divert money from MARC commuter rail and other state transit systems to continue funding Purple Line construction until it could line up longer-term financing in six months to a year.

The additional costs would come at a particularly bad time, state officials said, because the coronavirus pandemic has led to steep drops in revenue. The state is facing a $3 billion shortfall in its six-year transportation capital budget, officials testified.

The main legal question before the judge was whether the project’s contract allows PLTP to terminate the agreement after delays exceeded 365 days or if it first had to establish those delays via the project’s internal dispute resolution process.

The state had asked the judge to require PLTP and its construction contractor to continue working until the dispute resolution process played out.

However, Judge Jeffrey M. Geller rejected the MTA’s request for a preliminary injunction.

On Aug. 10, Geller issued a temporary restraining order requiring the companies to continue working past their planned Aug. 22 departure, but that order expired Monday. After the hearings this week, Geller declined to extend the order, saying it was “obvious” that the contract was “clear, direct and absolute” that either the state or PLTP may terminate it after delays exceeded one year, without the other’s consent.

The state, the judge said, “has no right to contest the [contract] termination.”

Geller also rejected the MTA’s arguments that allowing PLTP and its construction contractor to quit would cause the state irreparable harm and go against the public interest.

He said the costs that state officials complained about having to incur if PLTP leaves “appear self-inflicted” because they had “stubbornly” refused to discuss a transition plan after the companies announced their intention to quit.

While further delays may cause an “extreme inconvenience and may provide major headaches” for residents along the torn-up rail alignment, he said, the state would not suffer “irreparable harm.”

State officials’ own statements that they would finish the Purple Line “no matter what” also contradicted their legal arguments that the state would be irreparably harmed if PLTP were allowed to quit, Geller said.

A spokeswoman for the construction contractor, a joint venture led by Texas-based Fluor called Purple Line Transit Constructors, referred questions to PLTP.

Problems have plagued the Purple Line for years. An ultimately unsuccessful lawsuit filed by opponents stalled the start of construction by 11 months. PLTP said the state also lagged in providing right of way and changed design requirements for a new culvert and a crash wall between the Purple Line and CSX tracks.

The state has granted 160 additional days for the lawsuit delays but no additional money. It has rejected the other claims saying they were too late, exaggerated or the contractor’s fault.

A lawyer for the MTA questioned the timing of PLTP’s planned departure, saying it would occur just as the state would finish its nearly $1 billion in payments toward construction and bond proceeds would be used up.

Jaclyn Hartman, MDOT’s chief financial officer, testified that about $1 billion of work remains.

PLTP had planned to finance its share of construction — the part that remains — with an $875 million low-interest federal loan and $138 million of its own equity.

However, Hartman said she doubts PLTP has access to the federal loan because of the delays. A PLTP official testified that the companies have not yet contributed their own money.

Scott Risley, project director for Purple Line Transit Constructors, testified that the contractor had to terminate its construction contract with the concessionaire — a move that prompted PLTP to terminate its broader partnership with the state — because unpaid costs continued to mount. He said negotiations with MTA officials showed no “path forward.”

“We haven’t made a penny” on the Purple Line construction, Risley said. “We’re losing money, bleeding money every day we work.”

If PLTP couldn’t access the federal loan or other funds, Risley said, it couldn’t pay the construction companies to complete the line.

“There’s no way we could survive,” Risley said of the construction firms. “We have to get paid for the work we put in place. If we cannot, we don’t have the financial wherewithal to weather that. It’s something that would cripple the project.”

Under the public-private partnership, PLTP was to design and build the line over six years and then operate and maintain it for 30 years. The companies also would finance part of the construction, allowing the state to repay their debt over time.

The arrangement was supposed to provide the state a way to build expensive infrastructure by reducing government funding upfront and sharing many of the risks of a complex construction project with the private sector.