TRENTON — The government shutdown in New Jersey is over.

Lawmakers in Trenton late Monday broke through the impasse that had kept them from adopting the state budget, triggered the shutdown over the weekend, and frayed tempers among the public.

"Everything will be open probably starting tomorrow," State Senate President Stephen Sweeney (D., Gloucester) told a hastily called 10 p.m. news conference at the Statehouse.

He said he and Assembly Speaker Vincent Prieto, also a Democrat, had resolved their dispute over Gov. Christie's insistence on having legislation to restructure the state's largest health insurer, Horizon Blue Cross Blue Shield of New Jersey, approved prior to signing the budget. Without such a measure, Christie had threatened to veto Democratic priorities in the budget.

Sweeney called the $34.7 billion spending plan for fiscal year 2018 "the best budget we've seen in 10 years."

Christie had demanded that "excess" surplus at Horizon be used in part to provide health care to underserved residents. Prieto and others objected, with the speaker at one point likening the governor's demand to "extortion." Sweeney was inclined to go along with Christie's demand.

At the news conference, Prieto said that any excess reserves now would be returned to policyholders and that the state would not be able to touch the company's money.

Legislators were expected to vote on the Horizon measure and the budget later in the night.

Speaking to reporters at 11 p.m. Christie declared he had reformed Horizon and said, "I'll sign the budget tonight."

The developments came hours after legislative leaders met with Robert Marino, CEO of Horizon Blue Cross Blue Shield of New Jersey, the nonprofit at the center of the shutdown, which began at 12:01 a.m. Saturday after lawmakers failed to meet the constitutional deadline to pass the budget for the new fiscal year.

Around 9:45 pm, Horizon executive Bill Castner told reporters that Marino had met again with legislative leaders. Castner said he believed a resolution to the shutdown was in sight.

Lawmakers began trickling into the Statehouse for possible votes and legislative leaders scheduled their news conference.

The issue: Christie pledged to line-item veto Democratic-backed spending if lawmakers did not also pass a bill to reshape Horizon. Christie, a Republican, wanted to require the company to dedicate "excess" surplus to policyholders and public health programs.

But Prieto (D., Hudson) refused to hold a vote on the Horizon bill, calling the bill a "tax" on Horizon's policyholders. As a result, some Democrats did not vote on the budget, because they didn't want Christie to veto spending priorities such as school funding.

Earlier in the day Monday, after the meeting with Marino and Sweeney, Prieto told reporters that he had instructed his staff to draft legislation on Horizon.

"We're making progress," he said. "We will hopefully be voting on a budget soon."

Sweeney said he was hopeful of reaching a compromise on the Horizon legislation.

"It could move quickly if there's an agreement," he said.

In a statement after the settlement, Prieto said he had stood up for "sound public policy."

"Horizon ratepayers — a significant part of our state's population — will not be unfairly taxed, as previous plans allowed," he said.

State Sen. Joseph F. Vitale (D., Middlesex), a Sweeney ally and chairman of the Health, Human Services and Senior Services Committee,  said in a statement he was offering legislation that would "expand transparency and accountability" at Horizon by adding two public members to its board, requiring enhanced financial reporting, and setting a cap on its reserves.

Between 30,000 and 35,000 state workers were estimated to be furloughed during the shutdown, according to Christie's spokesman. Christie has said they would not receive back pay.

State parks, motor vehicle offices, and other services deemed nonessential were closed, while services including the state police, prisons, and the lottery continued to operate.

Chief Justice Stuart Rabner ordered state courts closed for all except emergency or essential operations.

State Superior Court Judge Ronald Bookbinder, the assignment judge for Burlington County, said that the shutdown Monday had little impact on scheduled court business.  "A day like today is normally calm because many people, whether it's lawyers or litigants, did not plan to come to court on Monday, July 3," he said, while sitting in his office at the county courthouse in Mount Holly.

"Essential operations" — arraignments and other emergent matters — were conducted Monday in a few courtrooms as planned, but also were minimal, he said.  "We anticipated the possibility of a shutdown last week and we had meetings and were prepared.  Now we're executing those plans," he said, adding that there was no confusion.

As the shutdown had unfolded Saturday, many visitors to local Motor Vehicle Commission agencies and campgoers denied access to state parks were among those taken by surprise.

"Everybody is very upset," said one camper from New York whose group was turned away at Wharton State Forest.

Christie defended his family's stay over the weekend at Island Beach State Park, which was closed to the public, but where the governor has a residence. Although Christie told reporters Sunday that he "didn't get any sun," a Star-Ledger photographer took aerial photos of the governor and his family on the beach earlier that day.

Lt. Gov. Kim Guadagno, who is running to succeed Christie, said Monday that the photos were "beyond words."

Sweeney declined to comment on the governor's time at the beach. Asked whether he had got any sun, Sweeney, while not particularly tanned, quipped, "This is [from] my blood pressure."

Staff writer Jan Hefler contributed to this article.