By Brian Bennett
December 21, 2018

The bipartisan bill to reform federal prisons hung in the balance on Dec. 10 as Van Jones settled into Jared Kushner’s cramped West Wing office. The liberal CNN host and criminal justice-reform advocate had been huddling with the senior White House adviser for months, and now they were running out of time.

As Jones munched mini peanut-butter cups from a bowl on Kushner’s table, the unlikely pair went over the checklist of tasks Senate Republican leader Mitch McConnell had asked them to complete before scheduling a vote on the measure. Secure 60 votes in the Senate? They had more than 80. Find time to take up the bill during a crowded end-of-year schedule? Key Republicans on the Senate Judiciary Committee gave them time set aside for confirming judges. Win support from law-enforcement groups? More had come on board. President Trump had even encouraged McConnell on Twitter to take up the bill. But the clock was ticking, and still McConnell hadn’t budged.

Sitting with Jones, Kushner agreed to make one more run at the Senate majority leader. “There was a look in Jared’s eye,” Jones recalls. And so, the President’s son-in-law and White House aides again appealed to McConnell, arguing that the time had come for a vote and it was his role to show that vocal critics of the effort, like Arkansas Republican Tom Cotton, don’t run the Senate GOP conference. The effort appeared to work. The next day, McConnell announced he was scheduling a vote on the bill.

Now the years of work by criminal-justice reform advocates on both sides of the aisle has paid off. On Dec. 19, the bill passed the Senate by a margin of 87-12. Even McConnell voted for it. And on Dec. 21, just hours before the government was scheduled to shut down, Trump signed the bill into law in the Oval Office, marking a rare bipartisan breakthrough. Advocates had not just coaxed support from once-skeptical senators. They had convinced a tough-on-crime president to back it, surmounted two years of partisan rancor and finished a landmark effort that had stalled during Barack Obama’s administration.

The new law will ease the sentences for some crack cocaine-related convictions and likely speed up the release of more than 2,600 federal prisoners. It will create a system for inmates to earn credits toward early release and sets up new programs designed to improve their ability to adapt to life after prison. It ends the practice of shackling pregnant women inmates; bans juveniles from being held in solitary in federal facilities; and gives judges more discretion in sentencing decisions. Proponents say the law, which only deals with federal inmates, can serve as a template for states and local jurisdictions that incarcerate the vast majority of the 2.1 million people jailed in the U.S.

The story of how the bill got to Trump’s desk begins with the broad coalition of conservatives and liberals—from the American Civil Liberties Union to the Koch brothers—who have been working on a solution to unnecessarily harsh prison sentences for years. And it includes an unlikely cast of key characters, including Kim Kardashian West and her husband Kanye; Trump’s son-in-law Kushner; and a 63-year-old former federal inmate named Alice Johnson. The bill brought together advocates from all points on the political spectrum, from Black Lives Matter activists, who are frustrated with drug laws that disproportionately incarcerate African Americans, to Tea Party conservatives who objected to what they saw as wasteful spending on prisons without evidence that holding nonviolent drug offenders kept Americans safe.

But the bill wouldn’t have become law had its advocates not found a way to convince a skeptical president to support the most sweeping reforms to federal prison sentences and rehabilitation programs in decades. On the campaign trial, Trump called himself the “law and order candidate.” As recently as March, Trump said getting tough on drug dealers “includes the death penalty.”

The turning point, White House officials say, was an Oval Office meeting in May between Trump and Kardashian West. Several months before, the reality TV star had been scrolling through her Twitter feed when she saw a viral video about Johnson, a first-time drug offender who had been arrested in 1993 in a Memphis cocaine trafficking case, and was serving a life sentence without parole in federal prison, becoming a grandmother and great-grandmother while incarcerated for a nonviolent crime. Kardashian West had tweeted the video out to her 59 million followers. Then, after digging deeper into Johnson’s case, Kardashian West called Ivanka Trump, the President’s daughter and senior adviser.

“I called Ivanka, thinking she would be able to help, and she would understand woman to woman, and really see and feel compassion, and she did,” Kardashian West told TIME in a phone interview. “Once you kind of get into it, you definitely see how messed up the system is.”

Ivanka Trump introduced Kardashian West to her husband Kushner, who had been working with lawmakers and advocates on prison and sentencing reforms. Kushner’s own father spent 14 months in federal prison starting in 2005 for tax evasion, illegal campaign contributions and witness tampering. Jared Kushner has told others that his family’s experience with the justice system has given him a sense of responsibility to take up prison reform at the White House. Kushner pushed hard for Trump to meet in person with Kardashian West.

An initial meeting was canceled at the last minute when skeptical White House officials asked for a thousand letters in support of Johnson. But Kardashian West persisted. After showing there was wide-spread support for Johnson, and lining up a job for her after her release, Kardashian West and her lawyer Shawn Holley met with Trump in the Oval Office May 30, along with Kushner and then-White House counsel Don McGahn.

Sitting across the Resolute Desk from the President, Kardashian West made the case for letting Johnson walk free. Kardashian West left the West Wing that day feeling like the meeting couldn’t have gone any better. And she was right. In June, Trump announced he was commuting Johnson’s sentence. “I just felt like we really changed somebody’s life,” Kardashian West says.

After that, Kardashian West joined Kushner and others in the broader effort to ease sentencing and promote programs that help inmates re-enter the work force. In a separate conversation with Trump in the Oval Office this fall, Kardashian West remembers Trump expressing his discomfort that someone the bill releases might go on to commit a crime. That’s what happened in the case of Willie Horton, who was convicted of armed robbery and rape while on a weekend release from prison in 1987. The case became the subject of Republican attack ads in the 1988 presidential campaign, and is widely seen as contributing to the defeat of Democrat Michael Dukakis.

When the President brought up Horton, supporters of the bill pointed to the way the public greeted Johnson’s release. “Donald Trump gave us the antidote to Willie Horton. He gave us Miss Alice Johnson,” says Jessica Jackson Sloan, co-founder with #cut50, a bipartisan effort to slash the U.S. incarceration rate by half. “She was going to die in prison. I think seeing cases like Miss Alice’s really had a huge impact on the President.”

Kardashian West agreed. “I was just excited because I know the President really went into this term really wanting to be hard on crime,” she says. “It doesn’t mean you can’t be hard on crime. It just means you are more fair about crime.”

Meanwhile, Kushner was marshaling Republican support for the effort in Congress, bringing conservatives and law enforcement leaders in front of Trump to describe why they would support the move. “I was one of those conservatives that helped him understand that the line up for support for reform might have been different than he assumed it would be,” says Matt Schlapp, the chairman of the American Conservative Union. “A lot of people would assume conservatives are ‘lock ’em up and throw away the key’ people. And I am one of those, for people who are truly dangerous to society. [But] how broadly do you define danger to society to the point where a kid makes a mistake and his life is destroyed forever?”

Schlapp explained to Trump that Republican governors in red states like Kentucky and Texas had been successful in reducing the state prison populations while saving money and curbing crime. “It’s not a great idea to take non violent people who have broken the law and put them into prison with hardened criminals. That scenario doesn’t usually result in healthier people,” Schlapp says.

The point was driven home for the president in August, advisers say, when Trump hosted a group of mostly Republican governors at his golf club in Bedminster, N.J., to discuss ways to make inmates less likely to commit offenses when they are released. Mississippi Governor Phil Bryant told Trump the effort would bring down crime overall, and that he should not let the fear of a Hortonesque attack ad get in the way of doing the right thing.

The bill, a version of which had already passed the House, gained steam in the Senate during the fall, pushed along in part by a dogged group of Republican Senators—including Judiciary Committee Chairman Chuck Grassley of Iowa—who worked closely with Democrats and outside advocates. Finally, on Nov. 14, Trump publicly backed the bill, saying it included “reasonable sentencing reforms while keeping dangerous and violent criminals off our streets.” He prodded Senators to pass it: “I’ll be waiting with a pen.”

That eventually made a difference for McConnell. “At the request of the president and following improvements to the legislation that have been secured by several members, the Senate will take up the recently revised Criminal Justice bill this month,” the Senate GOP leader announced Dec. 11.

On Friday, Trump finally signed the legislation into law. “Everybody said it couldn’t be done,” Trump said at the signing ceremony. “They said the conservatives won’t approve it. They said the liberals won’t approve it. They said nobody was going to approve it.”

Contact us at editors@time.com.

SPONSORED FINANCIAL CONTENT

Read More From TIME

EDIT POST