The megamerger between the health insurers Aetna and Humana has been blocked by a federal judge.

The deal, in which Aetna proposed to buy Humana for $37 billion, has been ruled anticompetitive by US District Judge John Bates.

"In this case, the government alleged that the merger of Aetna and Humana would be likely to substantially lessen competition in markets for individual Medicare Advantage plans and health insurance sold on the public exchanges," Bates' decision said.

"After a 13-day trial, and based on careful consideration of the law, evidence, and arguments, the Court mostly agrees."

Bates also said the companies' arguments that the merger would not have a negative impact on Medicare Advantage patients was "unpersuasive," saying regulators would not be able to prevent a combined company from raising prices on consumers.

Aetna now owes Humana a $1 billion breakup fee, according to Bloomberg.

"We’re reviewing the opinion now and giving serious to consideration to an appeal after putting forward a compelling case," TJ Crawford, a spokesperson for Aetna, told Business Insider.

Last summer, Aetna threatened to pull out of the public health-insurance exchanges established by the Affordable Care Act, the law better known as Obamacare, after the Department of Justice brought a lawsuit to block the merger.

In July, Aetna responded to a letter from the DOJ that asked what would happen to the company's ACA program if the deal were to be denied.

"Finally, based on our analysis to date, we believe it is very likely that we would need to leave the public exchange business entirely and plan for additional business efficiencies should our deal ultimately be blocked," Aetna CEO Mark Bertolini said at the time.

Of course, this may be a moot point given the desire of the Republican-controlled government to repeal the ACA.

Reuters last week reported that another healthcare tie-up, the Anthem-Cigna megamerger, would be blocked by a federal judge.

Former Attorney General Loretta Lynch argued in July when the suit was brought that both the Anthem-Cigna merger and the Aetna-Humana merger would hurt consumer choice and increase prices, saying "not only would the bank accounts of the American people suffer, but the American people themselves."

Representatives from Humana were not immediately available for comment.

Aetna's stock is sliding following the move, down by 2.5% as of 12:52 p.m. ET. Humana's shares are down by 0.2%.