ROME — Pope Francis washed and kissed the feet of a dozen inmates, including two young women, at a juvenile detention center in a surprising departure from church rules that restrict the Holy Thursday ritual to men.

The Mass was held in the Casal del Marmo facility in Rome, where 46 young men and women currently are detained. Many of them are Gypsies or North African migrants, and the 12 selected for the foot-washing rite reportedly included Orthodox and Muslim detainees.

Because the inmates were mostly minors — the facility houses inmates aged 14-to-21 — the Vatican and Italian Justice Ministry limited media access inside. But Vatican Radio carried the Mass live, and in his homily Francis told the detainees 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 youngsters. “Help one another. This is what Jesus teaches us. 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.”

Later, the Vatican released a limited video of the ritual, showing Francis washing black feet, white feet, male feet, female feet and even a foot with tattoos. Kneeling on the stone floor as the 12 youngsters sat above him, the 76-year-old Francis poured water from a silver chalice over each foot, dried it with a simple cotton towel and then bent over to kiss each one.

Previous popes carried out the foot-washing ritual on Holy Thursday in Rome’s grand St. John Lateran basilica. The 12 people chosen for the ritual were always priests to represent the 12 apostles whose feet Christ washed during the Last Supper before his crucifixion.

As archbishop of Buenos Aires, the former Cardinal Jorge Mario Bergoglio would celebrate the ritual foot-washing in jails, hospitals or hospices — part of his ministry to the poorest and most marginalized of society. He would often involve women: photographs from his days in Buenos Aires 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, however, was remarkable given current liturgical rules restrict the ritual to men.

Canon lawyer Edward Peters, who is an adviser to the Holy See’s top court, noted in a blog that bishops over the years have successfully petitioned Rome for an exemption to allow women to participate, but that the law on the issue is clear.