President Trump on Friday signed a sweeping criminal justice reform bill, marking a major legislative victory on an issue that garnered bipartisan support despite deep partisan gridlock on everything from immigration to health care.

“We have everybody wanting this,” Trump said before signing the bill, touting the “cross-section” of different interests that lined up behind the legislation.

The bipartisan moment was all the more noteworthy considering Trump's ongoing clash with Congress over border-wall funding, which he insists should be included in a broader government spending package. Without an elusive deal, a funding lapse will trigger a partial government shutdown at midnight.

CLICK HERE TO GET THE FOX NEWS APP

But on the sidelines of that fight, the House overwhelmingly approved the criminal justice bill Thursday on a 358-36 vote, after the Senate passed it 87-12. The decisive passage marks a win for Trump as well as his senior adviser and son-in-law Jared Kushner, who advocated for the bill in the face of some conservative resistance.

The First Step Act would give federal judges more leeway when sentencing some drug offenders and boost prisoner rehabilitation efforts. It also would reduce life sentences for some drug offenders with three convictions, or "three strikes," to 25 years. Another provision would allow about 2,600 federal prisoners sentenced for crack cocaine offenses before August 2010 the opportunity to petition for a reduced penalty.

It also incentivizes prisoners to participate in programs designed to reduce the risk of recidivism, with the reward being an earlier release to either home confinement or a halfway house to complete their sentence. This will not be made available to offenders who were also convicted of violent firearms offenses, sexual exploitation of children or high-level heroin and fentanyl dealing.

The changes were aimed at addressing concerns that the nation's war on drugs has exploded the prison population without helping people prepare for their return to society.

Prisoners also could get seven days of credit for good behavior each year of his or her sentence with this bill – with the credits being deducted from the sentence to allow for early release. The bill also expands eligibility for elderly or terminally ill prisoners to secure compassionate release.

After the bill passed, Trump tweeted his congratulations and described it as a "great bi-partisan achievement for everybody."

Passing the Senate, it had picked up the support of hardened anti-Trump Democrats, including Sen. Cory Booker, D-N.J. -- who heralded the bill as a start to righting the country’s “broken” criminal justice system.

“But for the first time in a long time, with the passage of this bill into law, our country will make a meaningful break from the decades of failed policies that led to mass incarceration, which has cost taxpayers billions of dollars, drained our economy, compromised public safety, hurt our children and disproportionately harmed communities of color while devaluing the very idea of justice in America,” Booker said.

While the bill passed both chambers comfortably, it had seen some passionate resistance from conservatives, led by Sen. Tom Cotton, R-Ark., who introduced amendments including one that would require victims be notified before a prisoner was released early. He had previously dubbed the bill a "jailbreak" over fears that it would release violent offenders onto the streets early.

But an array of liberal and conservative advocacy groups also rallied in support of the bill. The Koch-backed group, Americans for Prosperity, applauded senators for putting "policy ahead of politics." The American Civil Liberties Union said the bill was "by no means perfect. But we are in the midst of a mass incarceration crisis, and the time to act is now."

Fox News' Samuel Chamberlain, Kaitlyn Schallhorn and The Associated Press contributed to this report.