U.S. deaths from drug overdoses skyrocketed 21 percent last year, and for the second straight year dragged down how long Americans are expected to live.

The government figures released Thursday put drug deaths at 63,600, up from about 52,000 in 2015. For the first time, the powerful painkiller fentanyl and its close opioid cousins played a bigger role in the deaths than any other legal or illegal drug, surpassing prescription pain pills and heroin.

"This is urgent and deadly," said Dr. Brenda Fitzgerald, director of the Centers for Disease Control and Prevention. The opioid epidemic "clearly has a huge impact on our entire society."

Two-thirds of last year's drug deaths — about 42,000 — involved opioids, a category that includes heroin, methadone, prescription pain pills like OxyContin, and fentanyl. Fatal overdoses that involved fentanyl and fentanyl-like drugs doubled in one year, to more than 19,000, mostly from illegally made pills or powder, which is often mixed with heroin or other drugs.

Heroin was tied to 15,500 deaths and prescription painkillers to 14,500 deaths. The balance of the overdose deaths involved sedatives, cocaine and methamphetamines. More than one drug is often involved in an overdose death.

The highest drug death rates were in ages 25 to 54.

Preliminary 2017 figures show the rise in overdose deaths continuing.

The drug deaths weigh into CDC's annual calculation of the average time a person is expected to live. The life expectancy figure is based on the year of their birth, current death trends and other factors. For decades, it was on the upswing, rising a few months nearly every year. But last year marked the first time in more than a half century that U.S. life expectancy fell two consecutive years.

A baby born last year in the U.S. is expected to live about 78 years and 7 months, on average, the CDC said. An American born in 2015 was expected to live about a month longer and one born in 2014 about two months longer than that.

The dip in 2015 was blamed on drug deaths and an unusual upturn in the death rate for the nation's leading killer, heart disease. Typically, life expectancy goes back up after a one-year decline, said Robert Anderson, who oversees the CDC's death statistics. The last time there was a two-year drop was 1962-1963. It also happened twice in the 1920s.

"If we don't get a handle on this," he said, "we could very well see a third year in a row. With no end in sight."

A three-year decline happened in 1916, 1917 and 1918, which included the worst flu pandemic in modern history.

Overall, there were more than 2.7 million U.S. deaths in 2016, or about 32,000 more than the previous year. It was the most deaths in a single year since the government has been counting. That partly reflects the nation's growing and aging population. But death rates last year continued to go down for people who are 65 and older while going up for all younger adults — those most affected by the opioid epidemic.

The CDC also reported :

—West Virginia continued to be the state with highest drug overdose death rate, with a rate of 52 deaths per 100,000 state residents in 2016. Ohio and New Hampshire were next, both at about 39 per 100,000.

—Life expectancy for men decreased, but it held steady for women. That increased the gender gap to five years; about 76 for men and 81 for women.

—U.S. death rates decreased for seven of the 10 leading causes of death, but rose for suicide, Alzheimer's disease and for a category called unintentional injuries (which includes drug overdoses).

—Accidental injuries displaced chronic lower respiratory diseases to become the nation's third leading cause of death. Contributing were increases in deaths from car crashes and falls.

—Gun deaths rose for a second year, to nearly 39,000. They had been hovering around 33,500 deaths a few years ago.

The United States ranks below dozens of other high-income countries in life expectancy, according to the World Bank. Highest is Japan, at nearly 84 years.

"The fact that U.S. has basically stagnated over the past seven years — and now we're seeing small declines — is a real sign that the U.S. is doing badly," said Jessica Ho, a University of Southern California researcher who studies death trends.