As Pope Francis began his remarks at St. Patrick's Cathedral, he offered a prayer for the 700 Muslims who were killed in an annual pilgrimage to Mecca in a stampede Thursday morning.

"I unite myself with you all," the Pontiff said at evening prayers.

Then, he began to reflect on what he referred to as the spirit of gratitude and the spirit of hard work.

"A grateful heart is spontaneously impelled to serve the Lord and to find expression in a life of commitment to our work," Francis said in the official Vatican translation. "Once we come to realize how much God has given us, a life of self-sacrifice, of working for Him and for others, becomes a privileged way of responding to his great love."

Pope Francis spoke of gratitude and hard work as ways to fulfill a spiritual life. He cautioned against allowing luxuries and comforts that could blunt the lord's call. And he spoke of finding rest in new places. "Closeness to the poor, the refugee, the immigrant, the sick, the exploited, the elderly living alone, prisoners and all God's other poor, will teach us a different way of resting, one which is more Christian and generous."

He also touched on the clergy sex abuse scandal and, as at his other events in the United States, Francis said he stood with those who had "come forth from the great tribulation."

He also thanked the women of the Catholic Church, a statement met with wide applause.

"What would the church be without you?" the Pope said. "Women of strength, fighters, with that spirit of courage which puts you in the front lines in the proclamation of the gospel."

Francis also asked worshippers to stand firm and resilient in what he called an evolving pastoral landscape. "Whatever difficulties and trials you face, I ask you, like Saint Peter, to be at peace and to respond to them as Christ did: he thanked the Father, took up his cross and looked forward!"

Before Francis took to the pulpit, deep and soulful choral music continued to echo through the walls of St. Patrick's Cathedral as the evening prayers continued. Francis sat solemnly and observantly, presiding over his flock as many in the cathedral sang along with eyes closed.

Cellphones were up and cameras were flashing when Francis arrived, and he took his time greeting those who spent most of the day waiting for him. He switched from left pew to right pew to bestow greetings -- and occasionally hugs and a kiss -- to worshippers.

As he made his way down the aisle, Francis bent to embrace a girl in a wheelchair wearing a pink shirt, spoke in her ear and patted her on the cheek. After the pontiff left her in his wake, the girl wiped her eyes.

He held hands, shook hands, and accepted a heaping and colorful bouquet as he made his way to the looming replica of Pieta, or the statue of Christ, after he was taken down from the crucifix who is held in the arms of the Virgin Mary. Francis made the sign of the cross, solemnly looked up toward the statue, and moved on to the altar, where he bowed his head and prayed, then made the sign of the cross once more.

The gleaming polish of the floors reflected the soft light of the cathedral as the choir moved to a softer, slower song. Soon, the pontiff reappeared, adorned in his full papal vestments of dark gold, green and cream. In his left hand, he held a crucifix.

Before Francis' arrival, Bishop William Murphy of the Diocese of Rockville Centre took to the altar shortly before 6 p.m. after he was introduced by TV personality Matt Lauer.

Murphy, who worked for years in Rome at the Vatican, took the packed cathedral through a brief, erudite history of the Roman Catholic Church. He noted such facts as that the church has had 23 popes named John, 16 named Benedict, 13 named Innocent, but only one named Francis.

"Viva el Papa Francisco!" he said in Spanish, prompting applause, then added in English: "Long live Pope Francis!"

"We in New York love you and welcome you today and always. Amen."

Francis stepped out of the white, open-air Pope Mobile to the sound of clanging bells and screaming admirers at the steps of St. Patrick's about 6:43 p.m. Thousands of New Yorkers who waited for hours, lining miles of city blocks and Fifth Avenue to watch Francis' motorcade make its entrance cheered and waved to the pontiff.

He was welcomed the cathedral by Gov. Andrew M. Cuomo, Mayor Bill de Blasio and Sen. Chuck Schumer, and shook hands warmly with each man.

The screams from admirers overwhelmed even the sound of bells as the pope exchanged hellos with the three dignitaries, readjusted his white cap, and greeted fans with a wide smile and an arching wave.

Francis then shook hands with Cardinal Timothy Dolan as he proceeded into the cathedral, with choir and organ music greeting him.

The long line of church dignitaries welcoming him lasted several minutes, but at 6:46 p.m. he entered the sacred church to a bellowing chorus that proclaimed his arrival.

Worshippers began streaming into St. Patrick's hours earlier, some arriving around 2 p.m. to watch the pontiff attend the evening prayers, known to Catholics as vespers.

Before Francis' eagerly awaited arrival, ushers in formal white gloves led people into St. Patrick's while choral hymns such as "A prayer of St. Patrick" and "Ave Maria" filtered through the holy space.

Earlier, worshippers spoke in small groups and toured the cathedral while they waited. A mix of religious orders and lay people filled the historic church, and many anticipated the blessings that merely being in the presence of the world's most well-known holy figure would bring.

Among them was Bronx resident Vincent DeGregorio, who was given a ticket from Sister Oblates to the Blessed Trinity, where he has been a student, teacher and volunteer librarian.

It was the first time DeGregorio had been to the cathedral since it was restored.

"That the pope is here with the restoration -- it's magnificent," he said. "I hope to take home my blessing for my family because I have a very sick cousin who has cancer. I hope to take home some of that blessing for him."

Sister Helen Kearney, president of the Sisters of St. Joseph in Brentwood, had made it through heavy security and was waiting just before 3 p.m. with other religious men and women.

"I think there's a certain aura of excitement of being in Pope Francis' presence," she said.

Afternoon sun spilled through stained-glass windows onto the perfectly polished floors of the hallowed cathedral as they waited. Some worshippers soaked in the spirituality of the day or reflected on Francis' already pronounced legacy.

"I think it's fabulous we have a progressive pope for modern times," Lloyd Harbor resident Gregory G. Galdi said from his seat in the nave of St. Patrick's. "I'm humbled and honored to be here. It's interesting to see so many people here for the same thing. It's not for a sports event or a concert. It's spiritual."

"I think we're all here for one and the same purpose, which is to increase our faith and learn by example," Douglaston resident Joseph M. Mattone, 84, said. "We can all improve our lifestyle to help one another."

With Candice Ruud