A prestigious Boston hospital system and major health network can merge and form the state’s second largest health organization, but only under strict conditions, according to an agreement reached between the groups, Massachusetts Attorney General Maura Healey (D).

The Federal Trade Commission conducted its own investigation and Nov. 29 it had voted unanimously to close the probe, citing confidence in Healey’s agreement with the Beth Israel and Lahey.

The CareGroup Inc., led by Beth Israel Deaconess Medical Center, and Lahey Health System Inc., proposed merging in 2017 to form the Beth Israel Lahey Health System, with 13 hospitals and 4,300...