President Trump has signed a wide-ranging bill into law aimed at reducing addiction and deaths from opioids, an issue his administration has called a public health emergency.

"Together we are going to end the scourge of drug addiction in America," Trump said ahead of the signing. "We are going to end it, or we are going to make an extremely big dent in this terrible, terrible problem."

The 650-page-plus bill signed Wednesday is meant to tackle the crisis, giving healthcare workers more latitude to respond, and allocates roughly $8.5 billion in funding authorized in appropriations bills passed earlier this year.

The legislation allows more hospitals to receive government funding for taking in more patients, allows more medical providers to prescribe addiction treatments, helps the Postal Service intercept the potent opioid fentanyl, and encourages the development of a nonaddictive treatment to pain. Lawmakers stressed when they passed the bill that they saw it as only the beginning of their efforts.

Sen. Lamar Alexander, R-Tenn., the chairman of the Health, Education, Labor, and Pensions Committee, called the bill "the most important new healthcare law this year" and the opioid crisis the "nation's worst public health epidemic."

Opioid abuse has devastated communities across the country, claiming more than 40,000 lives in 2017 and contributing to a worrisome drop in U.S. life expectancy. The opioid crisis has reshaped the political conversation over how the government should approach addiction, with a renewed focus on compassion and treatment, rather than on law enforcement and incarceration.

[Related: CDC director calls for destigmatizing addiction to confront opioid crisis]

Politicians from both parties came together to craft the legislation, the SUPPORT for Patients and Communities Act, clocking in a rare bipartisan victory just ahead of Election Day.

Still, the crafting of the bill did not come without controversy. Democrats have said they would like to pour significant funding into fighting the crisis. Sen. Elizabeth Warren, D-Mass., and Rep. Elijah Cummings, D-Md., had introduced measures that would have provided $100 billion over a decade. The bill was modeled after the bill Congress passed to fight the HIV epidemic during the 1990s.

Sen. Patty Murray, the top Democrat on the HELP committee, said that the crisis was "far from over."

"We need to build on our work in this important legislation, which is why Democrats are going to keep fighting for more action and greater investments to provide our communities with the resources they need to address the root causes and ripple effects of this heartbreaking epidemic," the Washington senator said.

Opioids kill people in high doses by making breathing slow or stop. The opioid crisis began with the overprescribing of painkillers by doctors. Patients then became hooked on the drugs, and many turned to heroin, a cheaper alternative. Fentanyl, an even stronger opioid that is more deadly, has caused the vast majority of deaths in recent years and is mixed with other drugs, often without the users' knowledge.

The Centers for Disease Control and Prevention reported this week that they have observed a slight dip in the number of opioid deaths for six months in a row, though it won't be clear for some time whether the dip represents a turning point in the opioid crisis or a fluctuation.