Aetna Inc., a health-insurance company, agreed to buy Humana Inc., a major provider of private Medicare insurance, for $37 billion in cash and stock, the companies announced Friday. The acquisition could make the combined firms the second-largest health insurer in the U.S. The deal was struck amid a trend of mergers and acquisitions among health-care providers vying for government business because of the Affordable Care Act, aka Obamacare.

Experts suggest the deal was based in part on Aetna's desire to acquire Humana's almost 3.2 million participants in Medicare Advantage programs, which constitute one of the most important growing areas of the health-insurance industry where enrollment has tripled over the past decade, according to the Associated Press.

"Medicare Advantage is a coveted space," Michael Bernstein, a partner at Bain Capital's U.S. private equity team who focuses on health care, told Bloomberg Business before the transaction was announced. "To develop a similar scale in Medicare would take a great deal of work and time, which would be bypassed by making that transaction happen."

The deal is the largest ever in the insurance industry, Reuters reported. It is expected to close in the second half of 2016. News of the acquisition came a day after the Medicaid coverage provider Centene Corp. said it would spend $6.3 billion to buy Health Net Inc.

Humana shareholders will get $125 in cash and 0.8375 of an Aetna share for each of their shares, valuing it at about $230 per share, according to a statement released by the companies Friday morning. Humana closed at $187.50 a share in trading Thursday, putting the offer at roughly 23 percent above its last price. Aetna is based in Hartford, Connecticut, and Humana is headquartered in Louisville, Kentucky.

While the deal may be the largest in the insurance industry, it might be surpassed soon as insurers continue to merge in the wake of the U.S. Supreme Court's recent ruling on Obamacare. Cigna Corp. rejected a $47 billion bid from Anthem Inc., although sources say the companies are still in talks, AP reported.

"Government markets are the most rapidly growing aspect of the system," Dan Mendelson, CEO of the market-research firm Avalere Health, told the news agency.