Speaking to the young offenders, including Muslims and Orthodox Christians, Francis said that Jesus washed the feet of his disciples on the eve of his crucifixion in a gesture of love and service.
"This is a symbol, it is a sign. Washing your feet means I am at your service," Francis told the group, aged 14 to 21, at the Casal del Marmo detention facility in Rome.
"Help one another. This is what Jesus teaches us," the pope said. "This is what I do. And I do it with my heart. I do this with my heart because it is my duty. As a priest and bishop, I must be at your service."
In a video released by the Vatican, the 76-year-old Francis was shown kneeling on the stone floor as he poured water from a silver chalice over the feet of a dozen youths: black, white, male, female, even feet with tattoos. Then, after drying each one with a cotton towel, he bent over and kissed it.
Previous popes carried out the Holy Thursday rite in Rome's grand St. John Lateran basilica, choosing 12 priests to represent the 12 apostles whose feet Christ washed during the Last Supper before his crucifixion.
Before he became pope, as archbishop of Buenos Aires, the former Cardinal Jorge Mario Bergoglio celebrated the ritual foot-washing in jails, hospitals or hospices -- part of his ministry to the poorest and most marginalized of society. He often involved women. Photographs show him washing the feet of a woman holding her newborn child in her arms.
That Francis would include women in his inaugural Holy Thursday Mass as pope was remarkable, however, given that current liturgical rules exclude women.
Canon lawyer Edward Peters, who is an adviser to the Holy See's top court, noted in a blog that the Congregation for Divine Worship sent a letter to bishops in 1988 making clear that "the washing of the feet of chosen men ... represents the service and charity of Christ, who came 'not to be served, but to serve.'"
While bishops have successfully petitioned Rome over the years for an exemption to allow women to participate, the rules on the issue are clear, Peters said.
"By disregarding his own law in this matter, Francis violates, of course, no divine directive," Peters wrote. "What he does do, I fear, is set a questionable example."
The Vatican spokesman, the Rev. Federico Lombardi, said he didn't want to wade into a canonical dispute over the matter. However, he noted that in a "grand solemn celebration" of the rite, only men are included because Christ washed the feet of his 12 apostles, all of whom were male.
"Here, the rite was for a small, unique community made up also of women," Lombardi wrote in an email. "Excluding the girls would have been inopportune in light of the simple aim of communicating a message of love to all, in a group that certainly didn't include experts on liturgical rules."
Others on the more liberal side of the debate welcomed the example Francis set.
"The pope's washing the feet of women is hugely significant because including women in this part of the Holy Thursday Mass has been frowned on -- and even banned -- in some dioceses," said the Rev. James Martin, a Jesuit priest and author of "The Jesuit Guide."
"It shows the all-embracing love of Christ, who ministered to all he met: man or woman, slave or free, Jew or Gentile."
For some, restricting the rite to men is in line with the church's restriction on ordaining women priests. Church teaching holds that only men should be ordained because Christ's apostles were male.
"This is about the ordination of women, not about their feet," wrote the Rev. John Zuhlsdorf, a traditionalist blogger. Liberals "only care about the washing of the feet of women, because ultimately they want women to do the washing."
Still, Francis has made clear he doesn't favor ordaining women. In his 2011 book, "On Heaven and Earth," then-Cardinal Bergoglio said there were solid theological reasons why the priesthood was reserved to men: "Because Jesus was a man."
On this Holy Thursday, however, Francis had a simple message for the young inmates, whom he greeted one-by-one after the Mass, giving each an Easter egg.
"Don't lose hope," Francis said. "Understand? With hope you can always go on."
One young man then asked why he had come to visit them.
Francis responded that it was to "help me to be humble, as a bishop should be."
The gesture, he said, came "from my heart. Things from the heart don't have an explanation."
Follow Nicole Winfield at www.twitter.com/nwinfield