Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

It can be difficult to maintain hope ─ and keep from getting angry ─ when the government gives you freedom and then takes it back.

But Matthew Charles says he managed by remembering how far he'd come: more than two decades in federal prison for selling crack cocaine without a single disciplinary infraction and a growing group of supporters pushing for his release after he was released then imprisoned again.

"I refuse to disappoint myself or them," he told "NBC Nightly News" anchor Lester Holt in an exclusive interview airing Tuesday.

Charles, 52, reflected on his journey in a quiet park on the Cumberland River in Nashville five days after a judge ordered him released from prison for the second time in three years. The new order was made possible by changes to the criminal justice system signed Dec. 21 by President Donald Trump — a bipartisan effort known as the First Step Act, which eased mandatory-minimum drug sentences.

Charles struggled to find words that reflected how freedom ─ finally ─ felt.

"It's something I've been dreaming about for close to 21 years now, 22 years now, and since I went back," Charles said. "But I've just been praying and hoping that this day would come. And it has come. And it's a remarkable feeling."

Charles is believed to be the first person released under the new reform law, largely because of a public clamor over his case, which received attention from members of Congress and celebrities including Kim Kardashian West.

A longtime drug dealer from North Carolina, Charles was convicted in 1996 of selling 216 grams of crack and illegally possessing a gun. Labeled a "career offender" because of previous convictions involving drugs, weapons, domestic violence, breaking into homes, assault, kidnapping and larceny, he was sentenced to 35 years in prison.

Matthew Charles. Kim Cornett / NBC News

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Charles turned out to be a model inmate, authorities said. He organized a Bible study, mentored other prisoners and took college courses to become a law clerk, Nashville Public Radio reported in a 2017 profile.

Charles applied for early release several times, and a federal judge granted it to him in early 2016.

Once out of prison, Charles continued his mission to turn his life around. He moved to Nashville, got a job as a driver and volunteered at a food pantry. He also started dating again, and reconnected with his family.

But federal prosecutors fought the judge's ruling. An appeals court agreed that Charles did not qualify for release because he was a repeat criminal offender, and ordered him back to prison to serve an estimated nine more years.

He surrendered to a prison in Kentucky last May after two years of freedom.

"I refused to be bitter or angry," Charles said. "I got myself into the situation that I was in. And I did have a 35-year sentence, which was a legal sentence."

Outrage over his case sparked calls for President Trump to grant Charles clemency. At the same time, lawmakers and justice-reform advocates were pushing a rewrite of federal drug laws. The result was the First Step Act, which made retroactive a 2010 law easing mandatory-minimum sentences for crack offenses.

Charles' public defenders, Mariah Wooten and Michael Holley, argued in a Dec. 27 court filing that the provision applied to Charles. Prosecutors did not fight the motion, and on Jan. 3 a judge ruled Charles was "entitled to immediate release."

Charles said he didn't know about the motion until after his lawyers had filed it, and he didn't think much of it ─ he'd been through disappointing appeals before. Only after they called to let him know about the judge's ruling did he raise a triumphant fist and tell other inmates.

"I'm still trying to process all of this," he said.

Charles is now trying to piece back together the life he assembled during his last period of freedom. He plans to resume work as a driver and volunteering at a food pantry, guided by a deep sense of faith sparked by his reading a Bible in jail before his 1996 conviction.

"I think what Matthew shows is that people can change, character's not static and people can have redemption if given the opportunity to come out of federal prison and show they are a changed person," said Shon Hopwood, one of Charles' lawyers and an associate law professor at Georgetown University Law Center.

Charles recognizes that he is seen as a model for "rehabilitated" inmates who will benefit from the new law. More than 2,000 crack offenders are now eligible to seek early release under the First Step Act.

"Rehabilitation means ready to come out into society and live a law-abiding life," Charles said. "But the change that happened within me was stronger than just rehabilitation. It changed me personally. It made me want to obey the law and be a better person."

He also has to abide by rules of good behavior under a five-year term of supervised release.

That shouldn't be a problem, he said.

"Just do what I did last time," he said, "and stay out of trouble."