Centene, a major insurer that has significantly expanded under the Affordable Care Act, is making a bold bet as the Trump administration renews its attacks on the federal health law.

The company announced on Wednesday that it had agreed to buy WellCare, a smaller publicly held insurer based in Florida, for about $15.3 billion.

The deal would create a health care giant that specialized in offering private health plans under the enormous government programs Medicare and Medicaid. The combined company, with revenues expected to approach $100 billion in 2019, would cover 22 million people in all 50 states.

If the deal goes through, the acquisition of WellCare will cement Centene’s dominance in Medicaid coverage, the state-federal program for the poor, as well as in the Obamacare market, where it is the largest player.

It would also increase the company’s presence in the growing market for private plans under Medicare, the federal program for seniors.

“We will be a leader in Medicaid, Medicare and the health insurance markets,” Michael F. Neidorff, the chief executive of Centene, told investors on Wednesday morning.

“We do get a lot of scale,” Mr. Neidorff said later in a telephone interview. Centene has been eager to expand its offerings in Medicare, he said, particularly in plans geared to lower-income adults. “We pick up a good solid Medicare platform,” he said.

The Trump administration has been promoting private Medicare Advantage plans, including allowing them to offer additional benefits, and the market has proved lucrative for insurers.

Mr. Neidorff added that WellCare would be able to increase its presence in the Obamacare market. WellCare’s chief executive, Ken Burdick, said in a statement, “We are enthusiastic about the opportunity to create a high-performing combined business focused on government-sponsored managed care that will bring benefits to all of our stakeholders.”

The deal is the latest in a flurry of mergers among health insurers that are scrambling to better position themselves in a tumultuous time for the industry.

Earlier in the week, the Justice Department stunned health care experts and even some Republicans by asking a federal appeals court to invalidate the entire Affordable Care Act. If successful, the lawsuit would largely dismantle the individual market and reverse Medicaid expansion in three dozen states.

House Democrats introduced a proposal on Tuesday to bolster the law through a series of provisions like increasing federal subsidies, but there is also talk among Democrats of adopting a much broader “Medicare for all” program. Some proposals supported by 2020 presidential candidates would do away with private insurers altogether.

“Everybody is trying to anticipate what the health care environment is going to look like in the next decade,” said Les Funtleyder, a portfolio manager at E Squared who owns shares of Centene. The premise behind expanding Centene’s foothold “is the government is going to play a role regardless of what happens in the U.S.,” he said.

The acquisition would help insulate Centene from the continued threats against the federal health law, Mr. Funtleyder added. “It almost doesn’t matter if the A.C.A. is repealed, because somebody is going to manage Medicare and Medicaid,” he said.

Unlike other health insurers, Centene has aggressively moved into the volatile Obamacare markets in various states. The company had already become a major presence in Medicaid through its purchase of other plans, like New York’s Fidelis Care.

Mr. Neidorff, who would remain as chief executive of the combined companies, played down the political risks facing the two companies. He dismissed the idea that the health care law would succumb to the current constitutional battle in the courts or to some Republican lawmakers’ renewed calls to repeal the law.

“The Republicans lost the House on this issue,” he said.

Legal experts and others agree that the federal law has proved resilient, despite the myriad legal challenges and steps by Republicans to weaken it. Most believe other courts, possibly including the Supreme Court, will uphold the law.

Public support has also significantly increased, said Sabrina Corlette, a research professor at Georgetown University, who has closely followed the law’s travails. “When it’s most on the ropes, it’s been the most popular,” she said.

Mr. Neidorff also discounted the idea that the Democrats would adopt a sweeping Medicare for all proposal that would eliminate private insurers. The Democrats, including the party’s leadership, “know they can’t afford it,” he said. Lawmakers could also expand both Medicare and Medicaid using private insurance companies.

Investors reacted warily to the news of the deal, sending Centene’s stock down nearly 9 percent before it recovered to close at $52.12, down 5 percent from the previous day. Investors may have been disappointed that a bigger insurer, like Humana, would now be unlikely to seek to acquire Centene, said Ana Gupte, a stock analyst for SVB Leerink.

The two insurers also have some overlapping businesses that could raise antitrust concerns, Ms. Gupte said. “From a regulatory standpoint, it’s not a given,” she said, noting that “the odds are in their favor.”

But Ms. Gupte also said the political environment might give investors pause.

“There’s a lot of uncertainty,” she said, as Republican and Democratic lawmakers take strikingly different stances over what the health care system should look like heading into the 2020 presidential race. “It’s constantly being whiplashed from one end of the political spectrum to another.”

Under the terms of the deal, which also includes about $2 billion in debt, Centene would pay a fixed amount of its own shares and $120 in cash for each WellCare share. That amounts to about $305.39 per WellCare share based on closing stock prices on Tuesday, or about 32 percent above WellCare’s closing price. On Wednesday, WellCare stock closed at $259.81, reflecting some investor skepticism over the deal.

The combined company would be based in Centene’s home of St. Louis, and Centene shareholders would own about 71 percent of the business.

The deal is expected to close by June 30, 2020, pending the approval of regulators and both companies’ shareholders.