The merger of two major hospital networks in Massachusetts, Beth Israel Deaconess Medical Center and Lahey Health, will proceed — but with conditions negotiated by state Attorney General Maura Healey.

They include:

limits on annual price increases for the next seven years;

requirements that the new network bring more MassHealth patients into its hospitals and physician offices;

joint business planning with community hospital affiliates;

and $72 million in community investments, almost twice what the hospitals currently spend in that area.

The details are in a 55-page agreement filed in Suffolk Superior Court Thursday morning. Also Thursday, a federal regulator said it will not take action to block the merger.

"We share with the state and with the attorney general and her staff a real commitment to strengthening patient care but also to reducing health care costs," said Dr. Kevin Tabb, the CEO of Beth Israel Deaconess who will lead the new entity, Beth Israel Lahey Health (BILH). "This agreement with the attorney general does exactly that."

In a statement, Healey's office called the seven-year price cap "unprecedented." BILH will keep its annual contracts 0.10 percent below the state health care cost benchmark, which is currently set at 3.1 percent. The AG's office says that translates to $1.2 billion in avoided increases over the life of the agreement.

BILH will be required to hire an independent monitor for the next 10 years, who will issue an annual report on the network's compliance with this agreement.

To improve access for low-income patients, BILH will "make a good faith effort" to ensure all providers associated with the network accept MassHealth patients. (It's not clear how many do now.) BILH will not place any limits on MassHealth patient enrollment and will advertise to draw these patients to BILH hospitals, especially New England Baptist.

"These enforceable conditions, combined with rigorous monitoring and public reporting, create the right incentives to keep care in community settings and ensure all our residents can access the high-quality health care they deserve," Healey said in the statement.

BILH will make up 13 hospitals and will continue affiliations with Lawrence General Hospital, Cambridge Health Alliance and Brockton Signature Hospital.

It will invest $71.6 million over eight years in its six community centers and the safety net hospitals. That's about $32 million more than the hospitals would have spent if they maintained the current community investments on file with Healey's office. The new spending includes $17 million to expand behavioral health services, something Tabb says he is particularly pleased to include in the settlement.

"That's one of the things we feel strongly needed to be done independent of an agreement, but were happy to include in the agreement," Tabb said, noting that nearly half of adults in Massachusetts with a mental health disorder say they don't receive care for their illness and that the numbers are even worse for those with drug and alcohol dependence.

Dr. Howard Grant, who guided the merger as CEO of Lahey Health, retired in September.

Some of the provisions in the settlement with the AG overlap with conditions the state's Public Health Council has already placed on the merger. All parties say the two agreements are complementary.

BILH will be smaller than but will rival Partners HealthCare, the state's largest hospital network. And therein lies the promise and potential of this deal according to many health economists.

A report from the state's Health Policy Commission (HPC) discussed the merger's advantages and warned about its costs. It said BILH could use its increased bargaining power to demand price hikes of between $158 and $231 million a year. Those totals include higher prices for hospital stays and outpatient treatment, as well as primary and specialty care.

"In an ideal world, some of us would like [the price caps] to be permanent," said HPC Chairman Stuart Altman in response to Healey's deal, "but this is significantly more than any other type of restraint the state has ever imposed."

Altman says Healey's reliance primarily on the state's consumer protection law rather than anti-trust regulations when reviewing this merger was wise. The AG's office can return to court to seek penalties outlined in that consumer protection law if BILH violates any part of the settlement.

The Federal Trade Commission also issued a statement Thursday, saying "it has decided not to challenge the proposed transaction at this time." The commission said the "decision to close this matter was not an easy one."

The settlement with the AG's office is the latest test of a 2012 state health care cost control law that established the HPC, the hospital notice requirements and the final report that fueled this agreement.

"It's a little cumbersome, but in a sense of fairness I think it worked pretty well," said Altman, who credits BILH with avoiding steps that could have been more confrontational.

But some parties that opposed the merger are not pleased with the results.

“We are reviewing the settlement now, but are concerned that it may not protect access to care for vulnerable, low-income communities," said Salem City Councilor Domingo Dominguez, a member of the Make Healthcare Affordable Coalition, a group formed to oppose the merger.

A spokesman for Wellforce, a health care network that includes Tufts Medical Center and Lowell General Hospital, says health inequities will increase as BILH takes shape.

"This marks a turning point for Massachusetts health care as a second mega system will be allowed to form, increasing costs and doing little to ensure equal access and health care resources for all Massachusetts residents," Wellforce said in a statement.

The Greater Boston Interfaith Organization (GBIO) applauded Healey for imposing what it says are the first "real" price caps in Massachusetts. The state sets an annual benchmark for health care cost growth, but it is not enforced annually for individual institutions, as will be the case for BILH.

"We would like to see this kind of stronger language at least be the beginnings of more constraints on Partners and some of the other health care providers," said Bonny Gilbert, co-chair of the GBIO health care team.

And, says Gilbert, the caps must not be allowed to expire for BILH.