On Thursday, for the first time in American history, a president walked into a federal prison. President Obama went to see for himself a small piece of the damage from the nation’s decades-long binge of mass incarceration.

Obama’s prison visit in Oklahoma capped off a week in which he spoke powerfully about the failings of a criminal-justice system that has damaged an entire generation of Americans — disproportionately men of color.

After touring the cells, Obama reflected on the people he met there. “These are young people who made mistakes that aren’t that different than the mistakes that I made. … The difference is they did not have the kinds of support structures, the second chances, the resources that would allow them to survive those mistakes.”

This indisputable argument has been made by many others. But it is more significant coming from the president. On Tuesday, in a wide-ranging speech, Obama explained that people who commit violent crimes are not the reason for the exploding federal prison population. Most of the growth has come from nonviolent drug offenders facing absurdly harsh mandatory minimum sentences.

Obama also put a spotlight on intolerable conditions, like overuse of solitary confinement. He talked about community investment as the best way to stop crime before it starts. And he spoke of the importance of removing barriers to employment, housing and voting for former prisoners.

As Obama acknowledged, however, his powers are limited. Any solution to this criminal-justice catastrophe must come from Congress and state legislatures, which for decades enacted severe sentencing laws. In recent years, the opposite trend has taken hold as lawmakers in both conservative and liberal states have reduced populations in state prisons — where the vast majority of inmates are held.

It’s time Congress fixed the federal system.

One sign of how far the politics of criminal justice has shifted was a remark by former President Bill Clinton, who signed a 1994 law that played a key role in the soaring growth of the U.S. prison system. On Wednesday, Clinton said, “I signed a bill that made the problem worse.” It was a long-­overdue admission, and another notable moment in a week full of them.