GettyImages-480934106
United States President Barack Obama walked through the prison yard Thursday during a tour of the El Reno Federal Correctional Institution in El Reno, Oklahoma. Getty Images

President Barack Obama spent the morning in jail Thursday. The United States commander in chief visited El Reno Federal Correctional Institution in El Reno, Oklahoma, as part of his push for criminal justice reform. While at the medium-security facility, Obama saw cells, met with inmates and called for improved rehabilitation programs.

Obama's brief stop at El Reno was the first time a sitting U.S. president has visited a federal prison. While there, he gave an eight-minute speech on the importance of reducing overcrowding by limiting lengthy terms for nonviolent crimes, according to a White House pool report. "We have to consider whether this is the smartest way for us to both control crime and rehabilitate individuals," Obama said.

He told reporters he was especially moved by his visits with young inmates at the prison, which houses about 1,300 men. In his speech, Obama said he wasn't excusing their offenses but instead looking at how they could be diverted from jail or prevented from ever getting into trouble. About 71,000 of the 2.2 million prisoners in the U.S. were minors, Business Insider reported.

GettyImages-480925812
The entrance to El Reno Federal Correctional Institution in El Reno, Oklahoma, is shown Thursday as President Barack Obama arrived for a visit. Getty Images
GettyImages-480937270
President Barack Obama looked inside a prison cell Thursday at the El Reno Federal Correctional Institution. Getty Images
GettyImages-480937336
A prison cell was shown Thursday as seen through its door window following a tour of the cell block by President Barack Obama at the El Reno Federal Correctional Institution. Getty Images

"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," Obama told reporters. "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."

GettyImages-480937300
President Barack Obama, alongside Charles Samuels (right), the Bureau of Prisons Director, and Ronald Warlick (left), a correctional officer, toured a cell block Thursday at the El Reno Federal Correctional Institution. Getty Images
GettyImages-480937240
Secret Service and prison guards stood on the roof Thursday as President Barack Obama visited the El Reno Federal Correctional Institution. Getty Images
GettyImages-480934720
President Barack Obama spoke Thursday during his tour of the El Reno Federal Correctional Institution. Getty Images

The president also discussed prison reform earlier in the week at the annual NAACP convention in Philadelphia. Speaking Tuesday, he said the criminal justice system was "skewed by race and wealth" and that prisons shouldn't tolerate rape or gang activity, CNN reported. Obama also told attendees he'd requested Attorney General Loretta Lynch to look into the possible overuse of solitary confinement.