Congress approved a sweeping bipartisan criminal justice reform bill on Thursday, handing President Trump a major legislative victory on an issue championed by his White House.

The House approved the bill 358-36, sending it to Trump's desk for his signature. The legislation was approved earlier this week by the Senate, 87-12. The 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 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.

CLICK HERE TO GET THE FOX NEWS APP

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."

"When both parties work together we can keep our Country safer. A wonderful thing for the U.S.A.!!" he tweeted.

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.

FIRST STEP ACT ON ITS WAY TO BECOMING LAW: 5 THINGS TO KNOW ABOUT THE CRIMINAL JUSTICE REFORM BILL

“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.