During two whirlwind days in Philadelphia in September, Pope Francis will speak about immigration and religious liberty outside Independence Hall and visit inmates at the city's largest prison.

Archbishop Charles J. Chaput said the pope's itinerary says, "I walk with you - and so does the Lord."

Mayor Nutter, who returned last week from Rome as part of a delegation firming up plans for Francis' visit, said he was not surprised by the pope's plans to visit Independence Hall or a prison.

"I think what he has demonstrated to the world is that he cares about those who are often left out, locked out, or - in this particular instance - will be locked up," the mayor said.

"I think it is about human rights, freedom, liberty, and democracy, and how we treat each other."

The pope's visit Sept. 26 and 27 will highlight the World Meeting of Families congress, which will bring as many as 15,000 people to the city from Sept. 22 to 25. Although his appearances at Independence Hall and a prison were mentioned in an unofficial itinerary draft leaked last week, the events are now confirmed by the Vatican. It will be Francis' first visit to the United States since becoming pope and the first papal visit to Philadelphia since Pope John Paul II's in 1979.

Plans include stops in Cuba, Washington, and New York City before Philadelphia. The pope will meet with President Obama at the White House and address a joint session of Congress. In New York, he will discuss his recently released encyclical on the environment at the United Nations and join an interfaith service at the ground zero memorial.

In Philadelphia, the pope will celebrate Mass at the Cathedral Basilica of SS. Peter and Paul in Center City and visit Independence Hall, where he will speak on immigration - one of his favorite pastoral issues - and religious freedom.

He will be the guest of honor at a star-filled Festival of Families concert on the Benjamin Franklin Parkway, where at least 1.5 million people are expected to join him.

The Philadelphia Orchestra, the Italian tenor Andrea Bocelli, and the Colombian pop star Juanes will entertain at the festival.

On Sunday morning, the pope will meet with cardinals, bishops, and seminarians at St. Martin's Chapel of St. Charles Borromeo Seminary on City Avenue in Wynnewood and visit a group of prisoners, their families, and staffers at Curran-Fromhold Correctional Facility in the Northeast. He will celebrate Mass on the Parkway on Sunday afternoon.

Outside the prison Tuesday, Prisons Commissioner Louis Giorla said the pope would bring messages of "hope and encouragement" to inmates and "professional support" to prison staff.

Local and state officials and church leaders said they were thrilled to have the details of Francis' time in Philadelphia. They said they were not surprised he would shine a light on the needs of immigrants and prisoners.

"As the birthplace of religious freedom, Philadelphia is a city rich in history and diversity," Chaput said in a statement. "This itinerary recognizes the importance of those qualities and the pope's desire to witness them firsthand."

The pope's Philadelphia plans, he added, "seamlessly integrate powerful public moments with more intimate gatherings that are deeply grace-filled."

Robert J. Ciaruffoli, president of the World Meeting of Families Philadelphia 2015, said: "This is going to be a great, great visit by the Holy Father to our great city."

He said the event would showcase Philadelphia, "where immigrants came together to start this great nation."

The Rev. William Murphy, involved in immigrant issues throughout his priesthood - including when he served as pastor at Assumption of the Blessed Virgin Mary parish in West Grove, Chester County - said it was natural that Francis would talk about immigration.

"That has been an issue that is near and dear to his heart," said Murphy, now co-coordinator of the new Mother of Mercy House, a mission of the archdiocese in Kensington.

After Francis was elected pope, Murphy said, he made his first official trip out of Rome in 2013 to celebrate Mass on the Italian island of Lampedusa, to memorialize the thousands of North Africans who perished trying to cross the Mediterranean to seek refuge in Europe.

Francis himself is the grandson of immigrants from Italy to Argentina.

Murphy said he hoped Francis' address in Philadelphia would "keep the conversation going and ... challenge Christians to look at immigration in a Christian light."

Donna Crilley Farrell, executive director of the World Meeting of Families, said the pope's speech on immigration and religious freedom at Independence Hall on Saturday - to be called "We Hold These Truths" - was expected to attract between 30,000 and 50,000 people.

"This is about people who are marginalized," Farrell said. "I think for him, it is always about, how do we care for the human person? The Catholic Church has spoken out on issues of immigration for decades, for decades."

For the pope's visit to Curran-Fromhold, Giorla said, male and female inmates would be chosen from the city's prison population of 8,100. Good behavior will likely be a consideration for selection.

The pope will meet with selected inmates, their families, and staff members for about two hours on Sunday morning.

About 1,200 of the prison population identify as Catholic, Giorla said, but many faiths are practiced and 17 chaplains serve in area prisons.

The prison in Holmesburg, the largest in the city, is named in honor of Warden Patrick N. Curran and Deputy Warden Robert F. Fromhold, who were stabbed to death in a 1973 attack by two inmates.

Giorla said security procedures at the prison were already in place.

"We like to know and identify everybody who comes in the door," Giorla said. "We won't let everybody in, and we won't necessarily let everybody out." He said the prison was used to receiving "high-profile visitors, but nothing of this magnitude."

He said he was unsure how the prison was selected for the pope's visit, but said perhaps an earlier visit by Chaput had something to do with it.

When the archbishop said Mass at the prison in January, Giorla told him jokingly that the pope would "be more than welcome to pay us a visit, we'd be happy to host him - and it came true."

In April, Francis visited a juvenile detention center in Rome, where he washed and kissed the feet of inmates as part of a Holy Thursday ritual. The tradition honors what Christians believe was a similar act performed by Jesus before he was crucified.

The religious custom is a sign that "I am at your service," Francis told the young detainees.

The archdiocese said Tuesday that it had not been determined which events would require passes, but that the Festival of Families and papal Mass would be open to the public.

martha.woodall@phillynews.com 215-854-2789 @marwooda