President Obama, who in recent weeks has shed any reticence to talk about racism and discrimination in American life, suggested inside the walls of a federal prison in Oklahoma on Thursday that under different circumstances, he could have been there as an inmate rather than as president.

“That’s what strikes me — there but for the grace of God,” the president said, standing in an empty cellblock with polished concrete floors and gray-and-white walls.

Minutes after he had finished meeting with six nonviolent drug offenders in El Reno federal prison, a medium-security facility, Obama said his life could have taken a trajectory similar to the prisoners’ if he had not had the kind of family and community support many young men of color lack.

Obama, who has acknowledged using marijuana and trying cocaine in his youth, is the first sitting president to visit a federal prison.

“When they describe their youth, these are young people who made mistakes that aren’t that different from the mistakes I made, and the mistakes that a lot of you guys made,” the president said. “The difference is that they did not have the kind of support structures, the second chances, the resources that would allow them to survive those mistakes.”

U.S. President Barack Obama visits the El Reno Federal Correctional Institution outside Oklahoma City July 16, 2015. (Kevin Lamarque/Reuters)

The frank assessment — which the president delivered before a group of journalists — came just two days after he told a largely black audience: “I see what happens” when black and Latino families are devastated by the high rates of incarceration in their communities. And on Wednesday, during a White House news conference, Obama said that while the criminal justice system is not “the sole source of racial tension in this country, or the key institution to resolving the opportunity gap,” he sees reforming it as a way to help deliver on the nation’s promise of treating its citizens equally, without regard to race.

For a president who has often been reserved when discussing hot-button racial issues,Obama has begun to make a moral case that is based on his own identity.

“This is a moment when the president, speaking very candidly about the number of black men behind bars, is able to really talk about this issue in race-specific terms, and in a race-transcendent way,” said NAACP President Cornell William Brooks, whose group Obama addressed Tuesday in Philadelphia. “We have come to a moment that calls for candor.”

Obama has framed the overhaul of the national criminal justice system as an issue of fairness and common sense — saving taxpayers’ money and also keeping some offenders from becoming hardened criminals.

“We have to consider whether this is the smartest way for us to both control crime and rehabilitate individuals,” Obama said. “We have to reconsider whether 20-year, 30-year, life sentences for nonviolent crimes is the best way for us to solve these problems.”

Elected officials from both parties, as well as the president, have proposed revising the strict federal sentencing guidelines for nonviolent drug offenders put in place during the crack-cocaine epidemic of the 1980s.

On Monday, the president commuted the sentences of 46 men and women convicted under those sentencing guidelines. Last year, the Justice Department set criteria for granting clemency to such offenders; about 17 percent of the prison population has applied.

As part of the White House push to draw attention to the issue, Obama toured a facility in the flat prairie about 30 miles of west of Oklahoma City, where visitors must walk through numerous gates and past fences with barbed wire. The president walked down two long rows of cells, looking inside one that contained two beds, and had a sink and toilet in a corner. The prison is overcrowded, he said, with three inmates squeezed into a 9-by-10-foot cell.

Before speaking to reporters, Obama participated in a roundtable with the six inmates as part of a special that the network VICE is producing on the U.S. criminal justice system.

“For people who look at the president and can see themselves reflected in some part of him, having him acknowledge their existence and the hardship they face is extremely significant,” said Teresa A. Miller, a law professor at the State University of New York at Buffalo. “We have a prison system that really renders people invisible.”

David Fathi, director of the American Civil Liberties Union’s National Prison Project, said in an interview that Obama’s visit to El Reno sends a powerful message, but that by choosing that site, “He’s not going to see the most harsh and restrictive and problematic conditions in the Federal Bureau of Prisons.”

A man who served a year at El Reno more than a decade ago, and who spoke on the condition of anonymity so as not to jeopardize his job, said it was a well-run facility where inmates could work in the dairy as well as train on fire-station equipment.

“If you’re going to go to prison, it’s a good place to go to prison,” he said.

While the federal prison system had a crowding rate of 137 percent in 2013, the average rate for maximum-security facilities was 154 percent. In May, rioting at a severely-crowded Nebraska prison caused multiple fatalities.

“It’s an extreme level of overcrowding that is a recipe for disaster,” Fathi said of the rate at high-security prisons, adding that services including laundry, sanitation, medical care and security suffer when there is insufficient capacity. “After a certain level of overcrowding, every system breaks down.”

The expense of keeping so many people behind bars has helped fuel reform efforts in conservative states, including Oklahoma. Last week, Republican Gov. Mary Fallin asked Oklahoma’s state Board of Corrections to allow prisoners with the longest sentences to earn early release sooner, said Ryan Kiesel, executive director of the ACLU of Oklahoma. The legislature has also passed three reform bills, including one that would allow judges to deviate from mandatory minimum sentences in certain situations. Another would allow former felons to get some occupational licenses, and the third would end mandatory life without parole for certain repeat, nonviolent drug offenders.

“There’s a growing recognition in Oklahoma that these incarceration rates do not necessarily make our communities and our neighborhoods safer,” Kiesel said.

Eilperin reported from Washington.