MEXICO CITY — An hour before Pope Francis arrived at the Basilica of Our Lady of Guadalupe, the congregation began to cheer. The faithful could see the Holy Father, riding in his popemobile through the surrounding streets, on large screens.

More than 12,000 gathered inside the basilica, including Mexican President Enrique Peña Nieto and former President Felipe Calderon, while an estimated 30,000 participated in the Mass on the plaza.

“¬°Qué viva Cristo Rey! ¬°Que viva la Virgen de Guadalupe! ¬°Que viva el papa!” a man shouted moments after an announcement asked for everyone to remain seated before the Mass began. The crowd booed an announcement from the basilica that interrupted the livestream of the pope in his popemobile.

The pope vested in the Basilica Antingua, where the image of Our Lady of Guadalupe resided for years before the new basilica was erected in 1976. An estimated 20 million visit the shrine every year.

As Pope Francis entered the new basilica, the congregation — including some bishops — shed the light of their smartphone camera flashes upon him. He walked toward the altar, behind which resides the miraculous image of Our Lady of Guadalupe, which the pilgrim pope he had travelled so far to see.

The Blessed Mother appeared to St. Juan Diego in 1531, asking that a church be built in her honor on Tepeyac Hill. As proof of her request, she arranged Castilian roses in St. Juan Diego’s tilma. When St. Juan Diego brought the roses to the bishop, the miraculous image of Our Lady of Guadalupe was revealed on his garment.

“On that morning, at that meeting, God awakened the hope of his son Juan, and the hope of his people. On that morning, God roused the hope of the little ones, of the suffering, of those displaced or rejected, of all who feel they have no worthy place in these lands,” the pope said in his homily. 

“God came close and still comes close to the suffering, but resilient, hearts of so many mothers, fathers, grandparents who have seen their children leaving, becoming lost or even being taken by criminals,” he said.

While Juan Diego insisted he wasn’t the right person to oversee the building of the shrine, the Blessed Mother persisted.

“We are all necessary, especially those who normally do not count because they are not ‘up to the task’ or ‘they do not have the necessary funds’ to build all these things,” the pope said. “God’s shrine is the life of his children, of everyone in whatever condition, especially of young people without a future who are exposed to endless painful and risky situations, and the elderly who are unacknowledged, forgotten and out of sight.”

The pope invited everyone to come before the Blessed Mother, who asks us to aid our neighbors, forgive those who offend us, console the grieving, be patient, and “above all beseech and pray to God.”

After the homily, the pope asked all to join him in sitting quietly before the Blessed Mother in prayer. More than 40,000 — who had danced and shouted at his arrival — fell into utter, still silence.

At the conclusion of Mass, the Holy Father — who had asked the Mexican people for permission to pray privately before the image of Our Lady of Guadalupe — walked up into a small room behind the altar, directly behind where the image is usually on display.

Francis sat in private prayer before the image for 28 minutes, according to Jesuit Father Federico Lombardi, the Vatican spokesperson. The pope brought the Blessed Mother yellow flowers.

“It was long-awaited because the pope had said he was coming as a pilgrim to this shrine to see and to be seen by the Virgin of Guadalupe,” Father Lombardi said. The pope contemplated the message of proximity and encouragement, the message she gave to Juan Diego.

Earlier that day, the Holy Father visited the National Palace, the first such visit ever made by a pope, despite the nation having received six papal visits previously, from both St. John Paul II and Pope Benedict XVI.

“The Mexican people anchor their hope in an identity which has been shaped in the trying and difficult moments of its history,” the pope said.

“It was forged by the wonderful witness of citizens who understood that, in order to overcome situations born of the obstinacy of individualism, it was necessary to have agreement between the political, social and financial institutions, and of all men and women committed to the common good and the promotion of the dignity of the human person.”

Pope Francis, noting that more than half of the Mexican people are young, recognized the youth as the nation’s primary resource.   

“Leaders of social, cultural and political life have the particular duty to offer all citizens the opportunity to be worthy contributors of their own future, within their families and in all areas where human social interaction takes place,” he said. 

“This is not just a question of laws which need to be updated and improved — something always necessary — but rather a need for urgent formation of the personal responsibility of each individual, with full respect for others as men and women jointly responsible in promoting the advancement of the nation,” he added.

The pope also gave a lengthy talk to the bishops of Mexico at the Metropolitan Cathedral of the Assumption.

“Do not lose time or energy in secondary things, in gossip or intrigue, in conceited schemes of careerism, in empty plans for superiority, in unproductive groups that seek benefits or common interests,” the pope told the bishops. “Do not allow yourselves to be dragged into gossip and slander. Introduce your priests into a right understanding of sacred ministry.”

The pope said bishops should not be “princes,” but witnesses to Christ, the only light.

“In the glorified Christ, whom the people of this country love to honor as king, may you together kindle the light and be filled by his presence which is never extinguished; breathe deeply the wholesome air of his Spirit,” he said.

The pope also addressed the “cancer” of the drug trade.

“The magnitude of this phenomenon, the complexity of its causes, its immensity and its scope, which devours like a metastasis, and the gravity of the violence which divides with its distorted expressions, do not allow us as pastors of the Church to hide behind anodyne denunciations.”