NEW YORK/WASHINGTON (Reuters) - Health insurers Aetna Inc and Humana Inc walked away from their $34 billion merger on Tuesday and Cigna Corp sought to end its deal with Anthem, shelving the industry consolidation they charted to address former President Barack Obama’s Affordable Care Act.

Humana also said it would exit the Obamacare individual insurance market after this year, saying that early medical costs were running a bit high. Humana was one of several insurers that lost money in 2016 and then cut back offerings for this year, saying the program needs to be changed.

President Donald Trump and Republicans have vowed to repeal and replace Obamacare, the national healthcare reform law that created new individual insurance and expanded Medicaid, adding 20 million people to the ranks of the insured.

Trump on Tuesday tweeted about Humana’s decision to exit the market, promising he “Will repeal, replace & save healthcare for ALL Americans.”

The insurers, in seeking their mergers, had said the combinations would help them grow after the law changed everything from how doctors and hospitals are paid to the benefits insurers must provide.

The Aetna-Humana and Cigna-Anthem deals were announced in July 2015 and the Justice Department filed antitrust lawsuits a year later seeking to block the deals. Two federal judges separately ruled against the deals in recent weeks.

Government antitrust officials argued that both mergers would lead to less competition and higher prices for Americans, which Aetna and Anthem tried to disprove. The acquisitions would have reduced the number of national U.S. insurers from five to three.

A trader points up at a display on the floor of the New York Stock Exchange August 20, 2012. REUTERS/Brendan McDermid/File Photo

After the defeat in court on Jan. 23, Aetna and Humana said they were weighing an appeal. But they opted on Tuesday to scrap the merger. Aetna shares rose 3 percent to $125.81, while Humana fell 0.4 percent to $205.97.

Aetna will pay Humana a $1 billion breakup fee, or $630 million after taxes, and terminated its plan to sell some Medicare Advantage assets to Molina Healthcare Inc, the companies said. Molina will receive a $75 million breakup fee.

Humana said it will buy back at least $2 billion worth of shares in 2017 and earn a net profit of $16.65 to $16.85 per share, helped by the payment from Aetna, and raise its dividend.

Humana is the first insurer to withdraw from the Obamacare exchanges for 2017, but Aetna and Anthem have both said they are considering doing so if changes are not made to the plan.

Wall Street analysts and investors suggested that the Trump administration might be friendlier to deals, and that Humana could again be a target for Anthem or Cigna.

Humana CEO Bruce Broussard said on a conference call that the company would consider any takeover offer, balancing “the probability and timing of completing a transaction,” the current environment and the process it has just gone through.

CIGNA GOES TO COURT

Cigna said on Tuesday that it had notified Anthem that it had terminated its merger and that Anthem was required to pay a $1.85 billion breakup fee.

It also filed a lawsuit in Delaware, asking a judge to declare legal its decision to terminate the deal and to approve $13 billion in damages for shareholders who did not receive the takeover premium.

Anthem responded that the merger agreement was in place until April 30, 2017, and that Cigna could not back out. Anthem’s shares closed down less than 1 percent at $163.32 while Cigna rose less than 1 percent to $146.68.

Several antitrust lawyers said the two companies - which have been at odds for the past year - likely will settle the lawsuit.

“We knew for weeks that all they were doing was positioning themselves for this fight,” said Matthew Cantor, an antitrust litigator with the law firm Constantine Cannon. “Over 90 percent of these high stakes commercial litigation settle.”