WASHINGTON — Nearly 11.8 million Americans have signed up for coverage this year under the Affordable Care Act, about 3 percent less than last year, according to a new tally by The Associated Press.

Enrollment remained remarkably stable despite President Trump’s disdain for “Obamacare,” and repeated efforts by the Republican-led Congress to repeal the program. The Trump administration also cut the enrollment period in half, slashed the ad budget, and suddenly stopped a major subsidy to insurers, which triggered a jump in premiums.

“If you had asked me a year ago whether enrollment for 2018 would be almost equal to 2017, I would have laughed at you,” said Larry Levitt, who follows health law for the nonpartisan Kaiser Family Foundation. “So long as lots of people are still getting insurance it becomes much harder to take that away.”

The outlook for next year, however, remains unclear. Congress has repealed the unpopular requirement that most people carry health insurance or risk fines from the IRS. That’s expected to embolden some healthy people to go without coverage, which would raise premiums for those left behind.

The Trump administration also is promoting lower-cost insurance alternatives that don’t offer the comprehensive benefits available through the health law. If they prove popular, that could siphon off more healthy people.

Officially known as the Affordable Care Act, the health law offers subsidized private insurance to people who don’t have coverage on the job, through HealthCare.gov and state-run insurance markets.

AP’s count shows that states running their own marketplaces mostly outperformed the federal HealthCare.gov.

New York, Washington, Colorado, Rhode Island and Connecticut were among the state-run markets that increased their enrollment over last year’s numbers. State-run marketplaces tended to have longer sign-up periods and some invested heavily in marketing. Maine’s enrollment figures weren’t available Wednesday night.