WASHINGTON (Reuters) - The U.S. Congress on Thursday gave final approval to bipartisan legislation supported by President Donald Trump that would bring sweeping changes to prison sentencing and the treatment of inmates during incarceration and following their release.

FILE PHOTO: Jail cells are seen in the Enhanced Supervision Housing Unit at the Rikers Island Correctional facility in New York March 12, 2015. REUTERS/Brendan McDermid/File Photo

By a vote of 358-36, the House of Representatives passed the bill that was overwhelmingly approved by the Senate on Tuesday. It now goes to the White House for enacting into law.

Trump promptly praised the House action in a Twitter post, calling it “a great bipartisan achievement for everybody.”

The “First Step Act,” years in the making, represents an easing of tough, law-and-order minimal sentencing requirements imposed on judges that stemmed from a 1980s drive to clamp down on an epidemic of crack cocaine and other illegal drug use in the United States.

The tough enforcement fell heavily on African-Americans and Latinos, even though data pointed to whites constituting the majority of illegal drug users and dealers in the United States.

With about 2.2 million people incarcerated in the country, many of them serving long prison sentences for nonviolent crimes, conservatives and liberals in Congress worked in an uncharacteristically bipartisan fashion to pass the bill.

For fiscal conservatives, it represented an opportunity to lower the cost of operating federal prisons.

“These changes recognize the fundamental unfairness of a system that imposes lengthy imprisonment that is not based on the facts and circumstances of each offender and each case,” Democratic Representative Jerrold Nadler said during House debate.

Nadler is poised to become chairman of the House Judiciary Committee next month when Democrats take majority control of the chamber.

Key changes in the bill would be retroactive.

Jason Pye, a vice president at the conservative organization FreedomWorks, said in a telephone conference with reporters, “These reforms promote public safety, they actually help law enforcement” by helping convicts receive an education, job training and drug treatment.

Some conservatives and law enforcement organizations, however, warned the measure did not go far enough to ensure violent criminals are not released back into society.

The legislation comes as the United States has shown little progress on its “war on drugs” that was a centerpiece of former President Ronald Reagan’s administration decades ago.

An opioid epidemic is now devastating communities across the United States despite the fact that the nation has the highest incarceration rate in the world.

Under the bill, maximum penalties are maintained for violent felons and drug kingpins.

But mandatory minimum penalties are reduced for others by giving judges expanded discretion when handing down sentences. And prisoners can earn time credits toward their release to halfway houses or home confinement.

In an attempt to discourage repeat criminal activity by those released from confinement, the bill bolsters employment and training opportunities for those serving sentences. The U.S. Bureau of Prisons also would be required to evaluate experimental programs aimed at treating heroin and opioid abuse.