WASHINGTON -- Two companies crucial to the business of U.S. energy exploration, Halliburton and Baker Hughes, have abandoned their planned merger in the face of opposition by regulators who said it would hurt competition.

Prospects for the merger, which was valued at nearly $35 billion when it was announced in 2014, seemed especially bleak after the Justice Department sued to block the deal on April 6.

The government claimed the merger would lead to higher prices by unlawfully eliminating significant competition in markets for almost two dozen services and products crucial to finding and producing oil and natural gas in the United States.

"The companies' decision to abandon this transaction -- which would have left many oilfield service markets in the hands of a duopoly -- is a victory for the U.S. economy and for all Americans," Attorney General Loretta E. Lynch said in a statement on Sunday.

The Justice Department said its opposition to the deal stemmed in part from fear among oil and gas companies that rely on Halliburton and Baker Hughes.

"We heard extreme statements of concern from dozens of companies and over 100 individuals," Mark Gelfand, deputy assistant attorney general in the Justice Department's antitrust division, told reporters Monday. He declined to identify the companies and did not detail their concerns.

As part of the agreement, Halliburton will pay Baker Hughes the termination fee of $3.5 billion by Wednesday, according to a joint release from the companies on Sunday.

"While both companies expected the proposed merger to result in compelling benefits to shareholders, customers and other stakeholders, challenges in obtaining remaining regulatory approvals and general industry conditions that severely damaged deal economics led to the conclusion that termination is the best course of action," said Halliburton Chairman and CEO Dave Lesar.

Martin Craighead, chairman and CEO of Baker Hughes, said the "outcome is disappointing because of our strong belief in the vast potential of the business combination to deliver benefits for shareholders, customers and both companies' employees."

The Obama administration has taken credit for stopping more than 30 mergers that were abandoned after antitrust regulators sued or threatened to sue to block the deals. In dozens of other cases, the regulators reached settlements that allowed deals to go ahead, including big airline mergers.

Like other merger applicants, Halliburton said it would divest enough assets for the deal to pass antitrust scrutiny. But Gelfand said the deal was not fixable.

Gelfand said companies mistakenly believe that any merger can win approval if they agree to divest enough assets. In a "good remedy," companies will agree to sell off entire business units, complete with management, facilities and sales forces, but Halliburton proposed to "take a couple of assets from here, a couple of assets from there." An operator that bought such disjointed assets would have lost customers and been less competitive, he said.

Halliburton and Baker Hughes now face decisions about how to pick up the pieces and improve their companies while remaining smaller than their common rival, Schlumberger, and at a time when low oil prices have depressed drilling activity.

Baker Hughes will use proceeds of the $3.5 billion it will get from Halliburton to buy back up to $1.5 billion in stock, pay off about $1 billion in debt, and refinance a $2.5 billion credit facility. Overall, the company expects $500 million in annual cost savings by the end of the year.

Halliburton and Baker Hughes announced their plan to combine in November 2014, shortly after oil prices began to fall. Few, however, predicted the depth and duration of lower prices caused by a global oversupply of oil.

The glut slowed demand for drilling services and crushed the stock price of both companies.

Europe's top regulator, the European Commission, raised concerns about the deal. It said that it had investigated its potential impact on competition together with regulators in the U.S., Brazil and Australia.

In morning trading Monday, shares of Halliburton Co. rose 86 cents, or 2.1 per cent, to $42.17, while Baker Hughes Inc. shares fell $1.59, or 3.3 per cent, to $46.77.