Donald Trump has been bashing Obamacare a lot lately. This week, he did so in a state that’s become a major focus of his presidential campaign ― Michigan.

“It’s just been announced that Michigan residents are going to experience a massive double-digit premium hike,” Trump said Monday during a speech in Warren, a working-class suburb north of Detroit. “It’s been a disaster.”

The crowd roared with approval ― partly because you can’t really go wrong denouncing Obamacare at a Trump rally, and partly, one assumes, because some Michiganders are genuinely angry about how the Affordable Care Act is playing out in their state.

Overall, premiums for people buying coverage on their own, rather than through employers, are rising by 17 percent in Michigan ― a double-digit increase, just as Trump said. Although the majority of consumers are eligible for tax credits that would offset the higher prices, others make too much money to qualify for financial assistance. If they can’t switch plans, they’ll pay more for their insurance next year.

But Michigan’s market isn’t melting down. Far from it. With open enrollment for 2017 underway, consumers shopping for coverage on healthcare.gov will find an array of plans, many of them relatively cheap even before subsidies kick in. Meanwhile, the number of Michiganders without coverage has plummeted to a historic low.

This says something important about the debate over health care, which has taken on a more prominent role as the presidential campaign nears its end. We tend to talk about Obamacare like it’s one program, but it’s really more like 51 different programs ― one for each state, plus one for the District of Columbia. In some states, like Arizona, the insurance marketplaces for individual consumers look like actuarial train wrecks, and some residents are going to struggle as a result. In other states, like California, the marketplaces are functioning more or less as intended ― and the law is achieving most of its primary goals.

Michigan is a lot more like California than Arizona. In fact, it’s a case study in how the law works when favorable conditions exist. And better still, it offers hints as to what those conditions are.

Obamacare in Michigan, by the numbers

It’s easy enough to assess the Affordable Care Act’s impact in Michigan. The law took full effect in early 2014, and over the next two years, the share of Michigan’s population without health insurance fell from 11 percent to 6.5 percent. That’s based on 2015 census data, so the percentage is probably even lower now. Whatever the case, that’s a lot of people who now have access to health care and protection from sometimes crippling medical bills.

That development is hardly unique to Michigan. The ranks of the uninsured have fallen everywhere, particularly in states, like Michigan, that participated in Obamacare’s Medicaid expansion. But in Michigan, like every other state, there have also been trade-offs.

The new requirements on insurers ― to ignore pre-existing conditions, and to sell policies with a full spread of “essential benefits” like mental health and maternity care ― caused insurers to raise underlying premiums, or in some cases eliminate policies altogether. Subsidies offset the higher premiums, but not for everybody. In all likelihood, some of the Michiganders cheering on Trump this week were a few of the lucky people who had those old policies ― and who remember, bitterly, President Barack Obama’s promise that “if you like your plan, you can keep it.”

This “rate shock” has been a source of anger since the law took full effect in 2014. The new wrinkle ― which has given Trump an opening to focus on Obamacare these past two weeks ― is this year’s increases. Obamacare has basically been hit with a perfect storm. Insurers everywhere expected healthy people to sign up in greater numbers than they did. And a key program designed to protect insurers from losses in the program’s early stages expires this year.

As a result, insurers across the country are raising prices and, in some highly publicized cases, pulling out of markets altogether. In Phoenix, premiums are rising by 145 percent. A 40-year-old non-smoker ineligible for subsidies there will pay $507 a month, one of the highest rates in the country.

Michigan’s insurers have seen some of these problems, too.

“We expected the market to be bigger, with more people and more younger people than we enrolled,” Rick Notter, director of the exchange business for Michigan Blue Cross Blue Shield, told me recently.

The state’s insurers say they are particularly worried about “persistency” ― the extent to which people may be buying coverage during open enrollment or because of a qualifying life event like divorce, and then dropping it after getting a few expensive medical services.

“One of the biggest challenges in this market is that individuals aren’t staying enrolled for 12 months,” said Marti Lolli, senior vice president for commercial markets at Priority Health. ”A lot of people are staying enrolled just for three or four months.”

But while Michigan’s insurers are raising rates this year, they aren’t freaking out.

“We’re scheduled to break even in 2017, and 2016 was close to that,” Lolli said. “We did not experience the kinds of losses they had elsewhere, not even close. We’re on a good path and we think we can be in this for the long haul.”

The offerings on the marketplace reflect this confidence. Nine different insurers plan to sell coverage in Michigan next year, according to the Henry J. Kaiser Family Foundation. And in most parts of the state, inexpensive policies remain easy to find.

In and around Detroit, for example, a 40-year-old non-smoker can buy the second-cheapest “silver” policy, which the law treats as its benchmark, for just $237 a month. (Silver policies cover 70 percent of a typical person’s medical expenses.) That’s almost exactly what it cost to get the second-cheapest silver plan in Detroit last year ― and that’s without the tax credits, available to people with low to medium incomes, that can make coverage much cheaper or nearly free.

This year’s benchmark plan comes from Molina, a national insurer that has traditionally focused on low-income populations. Like most of the company’s plans around the country, the benchmark Molina plan offers a “narrow network” of doctors and providers. It also has a high deductible. But lower-income people get extra financial assistance to reduce the deductible, and the network includes well-regarded teaching hospitals like Harper University Hospital and Detroit Children’s. Doctor supply doesn’t seem to be a problem, either. The Huffington Post reached out to several physician practices on the official provider list, and each one confirmed that it was taking new Molina patients.

As for people who want smaller deductibles or more provider choices, they can choose policies that come with moderately higher premiums. Priority offers a silver-level HMO with a $2,500 deductible for $312 a month ― and again, that’s before subsidies on premiums and out-of-pocket costs. The plan’s network includes every major teaching hospital in the area and, according to Lolli, the vast majority of physicians as well. Overall, Detroit-area residents can choose from 83 different plans, with roughly half the plans in the silver category that the majority of consumers use.

As in the rest of the country, Michigan has rural patches with fewer, largely more expensive options. People who don’t get subsidies and stay with their current plans will pay more. But it’s also not hard to find residents like Amy Lynn Smith, a Detroit-area freelance writer with diabetes who said the law is saving her hundreds of dollars a month in premiums.

“It’s a huge step forward,” Smith told HuffPost. “Even though rates are going up in 2017 I’m still paying far less than I was before for the same comprehensive coverage.”

What Michigan got right ― and other states didn’t

Why is Michigan one of the states where Obamacare is having an easier time? In places like California, where Obamacare is working best, support from state officials has been a huge factor.

That appears to be the case in Michigan as well. Gov. Rick Snyder (R) is in some ways a throwback to a previous generation of Republicans ― business-oriented pragmatists who reliably fell on the conservative side of economic policy, but who didn’t hate the welfare state and who would work with Democrats to expand social programs if they saw it as a chance to help citizens at a reasonable cost.

That’s exactly what Snyder did. When Obamacare became law, he reasoned that the state would benefit by making Medicaid available to all low-income residents, as the law envisioned, because the federal government would be picking up most of the cost. It would mean more people with insurance, yes, but it would also mean more money for the state and its businesses. Snyder wanted Michigan to run its own version of the law’s marketplaces, because he figured state officials knew the local insurance markets well ― and would be in a position to smooth the transition to a new health insurance system, with more widely available coverage.

Snyder ran into resistance from conservative Republicans in the state legislature, and it took years of negotiation ― and lobbying from consumer and corporate interests ― to win approval for the Medicaid expansion. He never did win the marketplace fight. But the Medicaid expansion has allowed hundreds of thousands of people to gain coverage. And Snyder and his allies probably helped stabilize the marketplaces by having Medicaid pick up some patients with expensive medical needs who would have otherwise driven up premiums if they were buying private coverage.

Another big factor in Michigan ― again, common to the states where Obamacare is working best ― seems to be the health care landscape that existed even before the law took effect. As Marianne Udow-Phillips, director of the Ann Arbor-based Center for Healthcare Research and Transformation, explained to me recently, local and predominantly nonprofit insurers like Blue Cross, HAP and Priority dominate the state. The only national insurers that have thrived in Michigan are companies like Molina that specialize in insuring Medicaid patients and have done so for years.

What the Michigan-based and Medicaid insurers have in common, Udow-Phillips said, is that both have a lot of experience constructing networks of physicians and hospitals that will keep costs down. She noted that Michigan generally hasn’t had the sort of network problems seen in other states ― where patients sometimes get hospital care and discover they have surprise bills because out-of-network doctors were part of their medical teams.

A hidden factor in all of this, Udow-Phillips said, has been the influence of organized labor and its ability to demand good insurance for members.

“We’ve always had health plans that had better networks than in most places,” she said. “When labor unions were really strong here, they insisted on good networks of providers. And they [insisted] upon reasonable prices too.”

It also helps, Udow-Phillips says, that so many of Michigan’s insurers are nonprofits with histories of citing the public good as part of their missions.

Yet another element of Michigan’s success may be the way doctors and hospitals have responded to these demands ― and the way they’ve adapted in a market where the people paying for care (not just insurers, but employers and unions as well) have for years pushed for more efficient ways of delivering medical care.

“Michigan has been an innovative state for a long time,” J. Mario Molina, physician and CEO of the eponymous insurance company, told HuffPost. “In some states, it’s just ... let’s churn through patients, see how much money we can make. This state, it’s more sophisticated ― for example, when it comes to working on quality. Doctors understand that part of their compensation will depend on whether they provide quality of care, not just lots of care.”

Reforming Obamacare, in Michigan and beyond

Of course, a functioning market in Michigan doesn’t mean much for consumers in places like Arizona, North Carolina or Tennessee, where the problems are far more severe and may yet get worse ― resulting in higher prices for some people, and fewer choices for nearly everyone. On Wednesday, yet another national insurer, Anthem, warned that it will start scaling back its presence ― just as Aetna and UnitedHealth have ― if it doesn’t see better returns from its exchange products.

And even in Michigan, insurers say, Obamacare needs work. The Department of Health and Human Services recently announced changes to the law’s “special enrollment periods,” which were designed to make sure people could still get coverage after a major life event but which people may be exploiting in order to buy insurance only after they get sick. Michigan’s insurers cited these changes as an improvement, but they say the program needs further revisions ― particularly when it comes to a formula under which the plans that have relatively healthy customers subsidize the plans that don’t.

In theory, these sorts of reforms should not be difficult to enact. But some of the most important ones require legislative action, and Republicans in Congress have refused to discuss changes short of outright repeal.

They say that’s because the program is fundamentally broken. It’s the same argument Trump makes. But Michigan is one of the states that prove otherwise ― that Obamacare can work, especially if public officials will support it.

Editor’s note: Donald Trump regularly incites political violence and is a serial liar, rampant xenophobe, racist, misogynist and birther who has repeatedly pledged to ban all Muslims — 1.6 billion members of an entire religion — from entering the U.S.