After a prolonged battle for patients in the midcoast area, Parkview Adventist Medical Center has filed for bankruptcy and intends to merge with its former rival, Mid Coast Health Services of Brunswick.

Parkview said Tuesday that its Chapter 11 bankruptcy filing, which allows it to reorganize under court protection from creditors, includes a plan to merge with Mid Coast. The two hospitals for years have vied for leadership in the Brunswick, Bath and Topsham region, and in its filing, Parkview suggested that Mid Coast has been winning more patients.

Under the proposal, inpatient and emergency services will be consolidated at the Mid Coast campus at Cook’s Corner. The Parkview campus will be the base for the combined operations’ doctors’ practices; walk-in clinic; radiology, laboratory, ambulatory testing and surgery units; oncology, hematology and infusion services; and physical, occupational and speech therapy services.

Parkview will close its emergency department and acute inpatient care on Thursday, if the court approves, transferring those services to Mid Coast.

The hospitals said the plan, which needs approval from a federal bankruptcy judge, will preserve all part- and full-time jobs at Parkview.

Built in 1959, Parkview maintains 55 beds, while Mid Coast, formed through a 1991 merger of Bath Memorial Hospital and Regional Memorial Hospital in Brunswick, has 92 beds.

In its court filing, Parkview said at least some of its financial problems are because of contracts it has with Central Maine Medical Center in Lewiston, which provides Parkview with the personnel to run the hospital’s emergency room and also supplies Parkview with many of its administrative and billing functions.

Parkview said its emergency and inpatient numbers have declined, undermining the hospital’s financial stability.

That, combined with the CMMC contracts, means Parkview is “simply put … unable to sustain continued operations,” the court filing said.

Central Maine Healthcare, the parent of CMMC, said it didn’t know of Parkview’s plans to file for bankruptcy or of the proposed merger with Mid Coast, the company said in a statement Tuesday. The statement said Central Maine Healthcare learned about it by emails from its employees who are working at Parkview.

The statement said CMMC plans to continue to serve patients in Brunswick and Topsham through its primary care physician practices.

“Our patients expect and we plan to deliver high-quality patient care in the mid-coast region regardless of any change of ownership of Parkview,” the statement said. “We expect to continue to receive referrals and patients from the mid-coast area.”

The company also said it was reviewing its contracts with Parkview and its legal options.

Although he declined to comment specifically on the Parkview bankruptcy filing, Steven Michaud, president of the Maine Hospital Association, said hospitals in Maine and nationwide are going through a wave of mergers due to financial constraints, including declining state and federal reimbursement rates, a growing number of charity cases and rising costs.

“It’s happening nationally at a rapid pace, just because of the strains that are going on,” Michaud said. “And it will continue.”

In Maine, there were two big hospital mergers just last year. Mercy Hospital in Portland merged with Eastern Maine Healthcare Systems in Brewer, and Southern Maine Health Care was created by the merger of Southern Maine Medical Center in Biddeford and Goodall Hospital in Sanford.

Parkview and Mid Coast officials said they consulted with the Maine Department of Health and Human Services and the Maine attorney general to make sure the bankruptcy filing follows state laws. The case was filed in U.S. Bankruptcy Court in Portland.

Chapter 11 bankruptcies are designed to reorganize a foundering company by restructuring debt or finding new sources of capital.

Assuming the court approves of the filing, all emergency services will be provided at Mid Coast Hospital, which is at 123 Medical Center Drive, near Cook’s Corner in Brunswick. The Parkview walk-in clinic will be open daily from 8 a.m. to 8 p.m. and Mid Coast’s walk-in clinic downtown at Brunswick Station will be open the same weekday hours, and on Saturdays and Sundays from 8 a.m. to 4 p.m.

This story was updated at 8:25 a.m. to correct the hours of the clinics will be open.