The unification of Yale-New Haven Hospital and the Hospital of Saint Raphael’s is one step closer, hospital administrators announced Wednesday.

After years of financial troubles at Saint Raphael’s, the two hospitals first signed a letter of intent to merge last March, but the definitive agreement to finalize the merger, expected to be completed by early July, has taken two months longer. The agreement, which the hospitals have not yet publicly released, lays out the merger’s financial details and has been approved by both boards of directors. It will now be reviewed by state and federal regulators for possible negative effects on competition, a process that could takes months and during which the hospitals will continue to operate independently.

“Saint Raphael’s had a cash flow problem, and Yale-New Haven had a capacity problem,” said Geri Johnson-Reis, spokeswoman for Saint Ray’s. A higher percentage of patients at Saint Ray’s are on Medicare and Medicaid than at YNHH, Johnson-Reis added, making their finances always at the mercy of government funding cuts.

This merger would ensure that Saint Ray’s avoids bankruptcy and that New Haven keeps both its hospitals. But it is unclear whether some positions at Saint Ray’s will be eliminated.

Though the text of the agreement has not yet been made public, YNHH Director of Communications Rob Hutchison told the News on Thursday that it goes into detail on the specifics of how Yale-New Haven will purchase Saint Ray’s assets. He added that all 511 of Saint Ray’s beds will be added to Yale-New Haven’s 966 existing beds.

“We continue to be excited about the benefits to our communities and region that will arise out of the integration of services between Yale-New Haven and Saint Raphael’s,” President and CEO of Yale-New Haven Marna P. Borgstrom said in the press release.

Hutchison could not confirm that all St. Ray’s employees would keep their positions after the merger, but he said that integration of the hospitals would create net jobs “in the long run.”

Johnson-Reis added that because the regulatory process could potentially take months, Saint Ray’s will use the time to retrain employees whose jobs might otherwise be eliminated.

As of Thursday, the hospitals had not yet filed papers with the Connecticut Attorney General’s Office, whose approval is required for the merger to proceed, according to an email from the director of communications for the office.

The attorney general’s office will have to decide that the merger is in the best interest of the people of Connecticut, Hutchison said, adding that he was eager to present their case. The hospitals plan to file with all the required regulators in the next week, he said.

Still, even after papers are filed, approval may not be imminent. The Federal Trade Commision and the Connecticut Office of Health Care Access will need to ensure that the merger does not violate any laws regarding monopolies.

“The timeline could be eight months to a year,” Johnson-Reis said. “Other hospital mergers across the country have taken longer than that.”

The regulatory process could be even more difficult than the negotiations until now, according to Chris O’Connor, the CEO of Saint Ray’s.

“[Compared to the negotiations with Yale-New Haven,] the regulatory process is not within our control and we are relying on the regulators to agree with us that this is the right decision for our two hospitals,” O’Conner said in an email.

According to Johnson-Reis, O’Conner originated the idea for a merger after meeting with Yale-New Haven’s Borgstrom last year.

After the merger, Yale-New Haven will assume the pension obligations of Saint Ray’s, according to the press release. Hutchison said it will also recognize the Teamsters Local 443 Union that represents Saint Ray’s employees, even though no Yale-New Haven employees are currently unionized.

The press release also confirmed that Saint Ray’s will remain a “Catholic Institution,” and continue to provide medical care according to the Catholic Church’s “Ethical and Religious Directives,” which was essential for the merger. These directives forbid abortion, a procedure that Yale-New Haven currently offers and will continue to offer. They also mandate certain procedures in regards to end-of-life care.

“I know that some people are unsure what the future’s going to hold, but the opportunities for greater New Haven are huge,” Johnson-Reis said. “It’s such a better opportunity than being owned by a for-profit company somewhere else in the country, that doesn’t know a thing about New Haven.”

After communicating with multiple health care providers, the eventual result — being acquired by Yale-New Haven — was the ideal outcome, Johnson-Reis said.

The merger will combine the Yale School of Medicine’s residency programs at the two hospitals, which dean of the School of Medicine Robert Alpern said would be “just fine.”

“I think [the unified hospital] will be more efficient,” Alpern said. “There will be a lot less duplication of services.”

Yale-New Haven, founded in 1826, was the fourth private nonprofit hospital in the United States.