Bishop John Barres, on the eve of becoming the fifth bishop of the Diocese of Rockville Centre, delivered a rousing invitation Monday to young Catholics to energize the church and use social media to promote its mission.

With hundreds filling the pews of St. Agnes Cathedral for an evening prayer service, Barres held up a card with a photo of himself as bishop on one side and a basketball player on the other, asking the young to be “on fire with the word of God” in envisioning their future.

“You are critical to this moment of history,” Barres told them in his homily. “Dear young people, the hurts and wounds of life that you have already experienced at a young age can be the birthplaces of great compassion and service to others.”

Dignitaries, including Archbishop Christophe Pierre, the papal representative based in Washington, D.C., witnessed a ceremony filled with scripture and song prefacing Tuesday’s installation Mass.

As bishop of the nation’s eighth-largest diocese, Barres will shepherd 1.5 million Catholics in 133 parishes across Nassau and Suffolk counties. He succeeds Bishop William Murphy, 76, who has led the diocese since 2001 and is retiring.

His 18-minute sermon touched on the national furor set off by President Donald Trump’s crackdown on immigrants and visitors coming from seven majority-Muslim countries.

advertisement | advertise on newsday

Barres recounted how he and Bishop William Murphy, the diocese’s outgoing leader, went to Kennedy Airport to pick up Pierre and encountered lawyers from Catholic Charities of the Archdiocese of New York, on hand at the airport to help those who had been detained.

Pierre, who as papal nuncio is Pope Francis’ representative in the United States, went to the lawyers to express his support, reflecting the compassion shown by the pope, Barres said.

“We also open ourselves through the sacrament of penance to be more effective good Samaritans to our own families, our global family and especially the poor and suffering of the world,” the bishop said at one point. “Confession helps us break through the superficiality of consumerism and global indifference and makes us sensitive and compassionate to the needs of the poor, the hungry, the stranger and the persecuted refugee family.”

Barres, 56, who has been bishop of the Diocese of Allentown since 2009, sparked laughter in the crowd when he joked about the picture on his card that shows him playing basketball as a Princeton University student.

“You can tell it’s junior varsity because there are no people in the stands,” he said, drawing chuckles.

For a religion whose flock has been dwindling, Barres urged the young to help church leaders grow the faith: “We cast those nets globally and digitally, using every dimension of social media available. And dear young people, you ‘text’ and ‘tweet’ 20 times faster than the rest of us, so we are really counting on you!”

Murphy complimented Barres in remarks that closed the evening service.

“He’s a pastor who cares for all,” the outgoing bishop said.

advertisement | advertise on newsday

Murphy added a farewell to the congregation he has led for 15 years: “As I retire, I will spend my time talking to God about you.”

The crowd in the cathedral gave him a standing ovation.

Several said they are hopeful about the change in leadership and they like the focus on young Catholics.

“I’m sure he’s going to bring a new dimension” to the diocese, said Sister Kathleen Gallina, principal of the Saint Rose of Lima in Massapequa.

Giovanna Martinelli, 11, of Riverhead, said she was unexpectedly captivated.

advertisement | advertise on newsday

“I thought it was pretty amazing because this is my first time here,” she said. “It’s like a wonderful experience when you’re somewhere new and you think, ‘Oh, it’s not going to be that fun,’ but it’s actually pretty fun.”

Msgr. Tom Skindeleski flew in from his home diocese of Palm Beach to hear his friend Barres, calling him “kind, gentle, intelligent and nobody’s fool.”

Barres is “well-educated and well-prepared for a large, important diocese like Rockville Centre,” Skindeleski said.

Barres gained a reputation as an energetic, humble and down-to-earth bishop in Allentown, according to parishioners and clergy there. He launched numerous initiatives in Catholic schools, seminary programs and among Latino Catholics.

Barres, in recent interviews, said his goals for the diocese include bringing more people into Masses and parishes through the “New Evangelization,” attracting more seminarians and future nuns, and reaching out to the Island’s fast-growing population of Latinos — many of them Catholics.

With Ellen Yan