Top Senate Republicans and Democrats have reached a bipartisan deal on criminal justice reform, a breakthrough that has been years in the making. The proposal, which may be announced as soon as Thursday, has the crucial backing of Sen. Chuck Grassley, the conservative chair of the Judiciary Committee.

The bill would reform federal prison sentencing to reduce some of the automatic and harsh punishments Congress passed since it began cracking down on drug use. It would end the federal “three strikes” rule and limit the use of mandatory 10-year sentences for offenders who have not committed violent or major felonies.

RELATED: Life in prison for selling marijuana: Meet the people new pot laws forgot

Beyond reforming the length of some prison terms, the bill would also bulk up rehab programs for selected inmates, including job training, drug treatment and religious programs designed to reduce recidivism. The proposal also restricts the use of solitary confinement for juveniles, an increasingly controversial practice in American prisons.

Much of the legislation, tentatively titled the “Criminal Justice Reform and Corrections Act of 2015,” draws on bills previously introduced by reformers in both parties, including Democrats Pat Leahy, Sheldon Whitehouse and Cory Booker, and Republicans Mike Lee and Rand Paul.

While many of those proposals were bipartisan, reflecting a growing consensus on the need for some criminal justice reform, none had earned the backing of Chairman Grassley, who is seen as crucial to getting any legal reform through the GOP Senate.

President Obama, who has emphasized a “smart on crime” reform agenda for the Justice Department, has long advocated reforming mandatory minimums and non-violent drug sentences. This past weekend, HBO aired his visit to a federal prison to discuss these issues, the first ever by a sitting President.

Close video Obama administration charts a new course on incarceration President Obama has made criminal justice reform an increasingly central part of his policy as the administration approaches its final year. Glenn Martin from Just Leadership USA, Marc Mauer from The Sentencing Project and Rep. Barbara Lee, D-Calif.,… President Obama has made criminal justice reform an increasingly central part of his policy as the administration approaches its final year. Glenn Martin from Just Leadership USA, Marc Mauer from The Sentencing Project and Rep. Barbara Lee, D-Calif.,… share tweet email Embed

It would also expand mandatory minimum sentences for certain offenses, enhancing their use to punish selected firearm crimes and creating new mandatory minimums for offenses related to domestic violence and supporting terrorism.

The draft bill’s approach to punishment, however, does not simply march in one direction of rehab and more leniency.

That shift may address one of the common criticisms of the current federal application of mandatory minimums, which can result in heavier penalties for drug crimes than far graver offenses, such as violent crime.

The proposal would also expand a reform Congress previously passed, The Fair Sentencing Act, which reduced the punishment disparity in crack and powder cocaine. Congressional sources say the bill would apply some of that reform retroactively, benefitting current federal inmates who were incarcerated before the law was changed. The disparity – punishing the same cocaine violation differently based on its format – has long been cited as an arbitrary rule that resulted in disparate treatment for Black and White Americans using the same drug.