Access to primary care, more mental healthcare providers, and aggressive anti-drug programs are some of the reasons the Bay State is ranked at the top.

Living in the Bay State could give you a better chance of good health.

Massachusetts was ranked the “healthiest state” in the 2017 report from the United Health Foundation (UHF). Massachusetts also got high scores in the federal National Healthcare Quality and Disparities Report (NHQDR), which ranked it second only to Wisconsin.

Nearly universal health insurance, high incomes, and advocacy for the poor all made a difference.

“The politics, the culture, the history — all contribute to a commitment to access to high quality healthcare in Massachusetts,” Audrey Shelto, president of the Blue Cross Blue Shield of Massachusetts Foundation, told Healthline. “When I talk to colleagues around the country, I’m very grateful I live here.”

Massachusetts topped the UHF list for the first time. It was followed by Hawaii, Vermont, Utah, and Connecticut.

Ranked by median household income, all of these states are in the top quarter, except for Vermont, which falls just below.

Southern states, which are poorer, clustered at the bottom of the UHF list.

Each year since 1990, the nonprofit has ranked states, weighing 35 public-health measures, and analyzed national trends.

Around the country, many Americans face shortages of key doctors, the report found, and states vary widely.

The U.S. rate of early death rose for the third year in a row after decreasing for 25 years.

Both drug overdoses and cardiovascular deaths are increasing nationwide.

How do Bay Staters fare?

Massachusetts has more mental healthcare providers and dentists per person than any other state. It’s second in primary care doctors.

Drug deaths jumped there from 2012 to 2017, but cardiovascular deaths fell, defying the national trend. Infant deaths and deaths from cancer also declined.

The two healthiest states, Massachusetts and Hawaii, led the country in health insurance reform.

Right now, more than 97 percent of Bay Staters are insured.

Massachusetts’ commitment goes back to a 1988 law approved under Gov. Michael Dukakis.

In 2006 under Gov. Mitt Romney, Massachusetts voted in rules that became the blueprint for the Affordable Care Act (ACA). The ACA, known as “Obamacare,” then bolstered the state program.

State rules mandate what insurance policies cover.

Whatever happens in Washington, “The people in Massachusetts are protected,” Brian Rosman, director of policy and government relations at the nonprofit Health Care for All in Boston, told Healthline. “Insurance will still have to cover chemotherapy, mental health care, drugs, and maternity care.”

“We also provide more generous subsidies than under regular ACA, a legacy of the original bill. Our subsidies were based on real people saying what their budgets were and what they had left for medical care,” he said.

Massachusetts has promised to find ways to keep its Children’s Health Insurance Program (CHIP) going through June, even after Congress failed to extend funding.

The state has a generous Medicaid program that will cover most CHIP enrollees, although not immigrants who aren’t eligible for the program.

In March, the state will expand a program to improve care and use Medicaid dollars more effectively.

In Hawaii, which won top place in the UHF report for five years, a 1974 law based on a proposal from President Richard Nixon requires employers to cover most workers.

In 1989, Hawaii added a state program for “the gap group” who didn’t have employer insurance or Medicaid.

Infant mortality is a telltale public health statistic around the world.

The statistic reflects care for poor pregnant women and newborns, with minority groups hit hardest.

In the latest data from the Centers for Disease Control and Prevention (CDC), Massachusetts had the nation’s lowest rate, at 4.3 deaths for every 1,000 live births from 2013–2015. That compares with nearly 6 deaths on average across the United States.

Working hard to bring down infant deaths in poor urban areas, Massachusetts also has the nation’s lowest rate for African Americans at 8.3 per 1,000 live births.

“Years ago we acknowledged that we had a problem and it wasn’t acceptable. It was a huge initiative,” said Shelto.

Community health centers serve 1 out of 7 Massachusetts residents.

The centers are “accessible around the state and they focus on preventive care for people with lower incomes,” Rosman noted.

The first in the nation came in 1965 to Dorchester, Massachusetts, and Mound Bayou, Mississippi.

The state has more than 200 primary care doctors for every 100,000 people, as do Connecticut, Rhode Island, and New York.

Utah and Idaho residents, on the other hand, make do with fewer than 100.

Wider insurance coverage has boosted mental healthcare.

Suicide rates have been rising around the country. Massachusetts has a relatively low rate — just below 9 percent in 2015, compared to 13 percent nationwide.

Alan Holmlund, director of the Massachusetts Suicide Prevention Program, credits the state’s relative success to low rates of gun ownership, widespread access to addiction services, and effective prevention.

MassHealth, the state Medicaid/CHIP program, has a strong record of including mental health and addiction services in primary care, the state’s two U.S. senators and other legislators reported last year.

“It might take just a few questions at a check-up, and a primary care doctor could refer a patient to a social worker one door down, and they could go right away,” Shelto said. “There are lots of organizations that have been doing this in Massachusetts for a long time.”

The Cambridge Health Alliance, a community health center, has launched programs for the seriously mentally ill that dramatically cut emergency room visits and hospitalizations.

The expansion of benefits that began in 2006 also encouraged therapists and other mental health providers to stay in the state.

Massachusetts has more than six times the concentration of mental health providers than Alabama, where there are only 85 providers for every 100,000 people.

Even so, mental health needs go unmet, as they do elsewhere.

Massachusetts residents report many phone calls and long waits to find care, especially outside of Boston and other urban areas, according to a 2017 survey for the Blue Cross Blue Shield of Massachusetts Foundation.

It takes from two to nine months to land an appointment, the survey found.

Psychiatrists who treat children and teens are the most heavily booked.

Although Massachusetts has one of the nation’s worst drug problems, it’s fighting back.

In the UHF analysis, it ranks in the bottom 10 on drug deaths, with slightly less than 20 for every 100,000 people.

However, state authorities estimated a 10 percent decline in opioid deaths in the first nine months of 2017 compared with the same period in 2016.

One reason: Naloxone, the overdose-reversal drug, is more available in Massachusetts than it is elsewhere, and it’s saving lives.

The state has added treatment beds and put seven-day limits on new painkiller prescriptions.

In November, Gov. Charlie Baker proposed a bill that authorizes police or medical care providers to take people “at risk of serious harm” to treatment centers, hold them for up to 72 hours, and then petition courts to mandate care if the patient refuses.

The bill also envisions rules to allow every pharmacy to dispense naloxone, requiring credentials for “recovery coaches,” and requiring treatment centers not to discriminate against patients with public insurance.

If the state turns around its drug death toll, it will set a model for the nation.

From 2012 to 2017, only Florida has seen a decline in drug deaths.

Massachusetts has already won top scores in the UHR report for programs that promote “health improving” behavior.

Fewer Americans — now just over 17 percent — are smoking cigarettes. In the Bay State, the figure dropped to 13 percent from more than 18 percent in 2012.

On the other hand, more than 20 percent of Bay Staters binge drink or drink too often, putting the state in the bottom fifth nationwide.

Massachusetts has a slimmer population than other states, which contributes to better health outcomes.

Around a quarter of the state’s citizens are obese, compared to 30 percent nationally.

Only Colorado does better, with a 22 percent obesity rate. That is still higher than in all of the developed countries with data.

About 80 percent of Bay Staters say they exercise, which puts Massachusetts 11th in state rankings.

Utah and Colorado, with world-class skiing and hiking destinations, top that list.

In March, MassHealth is rolling out a new system for most beneficiaries.

Depending on your primary care doctor, you’ll be assigned to an “accountable care organization” (ACO).

Some 10 states have early ACO Medicaid programs.

In Colorado and Oregon, Medicaid ACOs have cut emergency room visits and hospital admissions — with net savings.

In the new Massachusetts program, Medicaid dollars can go toward preventive care, even if it looks “nonmedical,” Rosman said.

“Traditionally, Medicaid wouldn’t pay for an air conditioner for a child with asthma who needed it,” Rosman explained.

As Shelto notes, cutting costs is tough.

“But this a community that comes together and recognizes and grapples with tough issues,” she said.