WASHINGTON — Two coal companies embroiled in a battle over health care benefits for retired mine workers agreed to provide $400 million to the retirees, whose push for the benefits was strongly supported by Catholic and other religious advocacy groups.

Peabody Energy and Patriot Coal will provide the funds over the next four years, bringing to a close a campaign coordinated by the United Mine Workers of America. Peabody will make payments totaling $310 million, while Patriot will contribute $90 million under the agreement.

The funds will be administered through a Voluntary Employee Beneficiary Association that will established by the parties.

The union had challenged Peabody and Patriot to live up to their responsibilities to the retirees in a 15-month campaign that saw protests and symbolic arrests that alternated between both companies' offices in St. Louis and Charleston, W.Va., as well as other locales.

Glenmary Father John Rausch, director of the Catholic Committee on Appalachia, who was arrested during one of the rallies, welcomed the settlement.

"I'm happy that the UMWA got as much as they got," he said. "Labor has always been, in recent times, on the short end. They don't have the power. However, stepping back, this was money that was owed to those workers. It wasn't largess one the part of the companies. This is justice This is not charity."

The protests began after Patriot declared bankruptcy in July 2012 saying it could not afford the $1.6 billion in pension and medical insurance called for under contracts with the UMWA.

Patriot's critics maintained that the company was doomed to fail from its start in 2007.

Records show that Patriot was spun off in 2007 by Peabody, the world's largest coal producer. Peabody put all of its unionized mines in Kentucky and West Virginia under the new company. Another coal producer, Arch Coal, did much the same by creating Magnum Coal and placing its unionized mines in that company. Patriot later absorbed Magnum.

The end result was that very few of the retirees ever worked for Patriot but were dependent on that company for their retirement benefits.

Among supporters of the campaign pushing for their benefits were the Catholic bishops of Kentucky, who in September signed on to a statement saying that retired members of the UMWA must be able to obtain their benefits, as promised by their original employers.

The statement cited Blessed John Paul II's encyclical "Laborem Exercens" ("On Human Work"), which discusses Catholic social teaching that the responsibilities of "indirect employers," like Peabody and Arch, do not cease with the formation of Patriot.

The new agreement, announced Oct. 10, required that the UMWA give up virtually all of its 35 percent stake in Patriot, which the union received after negotiations led to a new contract between the mine workers and the company. The negotiations came after federal Bankruptcy Court Judge Kathy Surratt-States ruled in May that Patriot could eliminate its collective bargaining agreements with the union and cut retirement benefits.

Cecil Roberts, UMWA president, welcomed the agreement even though it will fall short of covering all retiree health care costs.

"This is a significant amount of money that will help maintain health care for thousands of retirees who earned those benefits though years of labor in America's coal mines," Roberts said in a statement. "This settlement will also help Patriot emerge from bankruptcy and continue to provide jobs for our members and thousands of others in West Virginia and Kentucky."

A Peabody executive also was pleased with the settlement.

"Peabody has continued to fund health care benefits for retirees during Patriot's bankruptcy proceedings," Alexander C. Schoch, executive vice president law, chief legal officer and secretary, said in a statement. "We are pleased to resolve the uncertainty among Patriot retirees by providing substantial funding for the newly established Voluntary Employee Beneficiary Association. Future health care benefits for Patriot retirees will now be determined by managers of the new VEBA."

Roberts pledged to continue to seek legislative reforms that would place the retirees under the Coal Act, securing their long-term health care benefits without additional cost to taxpayers.

Legislation has been introduced in both houses of Congress allowing for such an arrangement.