A federal judge has rejected health insurer Aetna’s bid to buy rival Humana on grounds that the deal would hurt competition in hundreds of Medicare Advantage markets, ultimately affecting the price consumers pay for coverage.

U.S. District Judge John Bates said in an opinion filed Monday that federal regulation would probably be “insufficient to prevent the merged firm from raising prices or reducing benefits,” and neither new competitors nor an Aetna plan to sell some of the combined company’s business to another insurer, Molina Healthcare Inc., would be enough to ease competitive concerns.

Aetna spokesman TJ Crawford said the insurer was reviewing the decision “and giving serious consideration to an appeal after putting forward a compelling case.”

Aetna, the nation’s third-largest health insurer, had announced in 2015 its plan to spend around $34 billion on Humana Inc. and become one of the top providers in the fast-growing Medicare Advantage market. Medicare Advantage plans are privately run versions of the government’s Medicare program for people who are over age 65 or disabled.

The Justice Department sued last summer to block Aetna’s deal and Blue Cross-Blue Shield carrier Anthem Inc.’s separate, $48-billion purchase of Cigna Corp. Both cases went to trial late last year. An opinion has yet to be rendered for the Anthem case.

The two deals would consolidate the nation’s five largest insurers into three, a list that includes UnitedHealth Group Inc., currently the largest.

The big insurers had argued that by getting bigger they will be able to negotiate better prices with pharmaceutical companies, hospitals and doctor groups that also are growing. They also expect to cut expenses and add more customers, which helps them better spread out the cost of investing in technology to manage and improve care.

But Bates, who is based in Washington, D.C., said in a 158-page opinion that the Aetna-Humana combination would “likely substantially lessen competition” for Medicare Advantage plans in 364 counties and, separately, in some Florida public insurance exchanges.

Deputy Assistant Attorney General Brent Snyder said in a statement that the decision was “a victory for American consumers - especially seniors and working families and individuals.”

Industry experts have said any impact from the deals on consumers would take years to materialize and could lead to savings in some areas, along with the risk of higher costs elsewhere.