Facebook founder Mark Zuckerberg gave the commencement address at Harvard University on Thursday, closing his speech by sharing a Jewish prayer called the “Mi Shebeirach,” which he said he recites whenever he faces a big challenge and which he sings to his daughter, thinking of her future, when he tucks her in at night.

“It goes, ‘May the source of strength who blessed the ones before us help us find the courage to make our lives a blessing,’ ” he said. “I hope you find the courage to make your life a blessing.”

Zuckerberg was quoting a version of the “Mi Shebeirach” prayer for healing that was written by Debbie Friedman, one of the most significant Jewish musicians of the past 50 years.

Many synagogues of all kinds have adopted Friedman’s version of the prayer. Toward the end of the service, they typically read the names of sick people, or ask people to speak the names of their own loved ones who are ill, and then they sing the prayer.

On Christmas Day last year, Zuckerberg wrote in a Facebook status that he was “celebrating Christmas.” A commenter asked him if he was an atheist. Zuckerberg identified himself as an atheist for years, but on Facebook on Christmas he responded: “No. I was raised Jewish and then I went through a period where I questioned things, but now I believe religion is very important.”

He didn’t answer further questions about what he believes. He met Pope Francis in 2016 to discuss bringing communication technology to the world’s poor.

In his address, he urged students to work toward something bigger than themselves.

“I’m here to tell you that finding your purpose isn’t enough,” he said. “The challenge for our generation is to create a world where everyone has a sense of purpose.”

Sense of purpose is especially important today, he said.

“When our parents graduated, that sense of purpose reliably came from your job, your church, your community,” he said. “But today technology and automation are eliminating many jobs. Membership in a lot of communities is declining.”

Zuckerberg told the story of how Facebook employees were torn over whether to sell the company several years ago, saying he felt there was a bigger purpose. He urged graduating students to find projects bigger than themselves, to redefine equality and build community across the world.

He suggested that the millennial generation work on issues such as climate change by installing solar panels, curing diseases by getting people to share their health data and modernizing democracy by having everyone vote online “not just to create progress but to create purpose.” He suggested exploring ideas such as universal basic income to make sure everyone has a cushion to try new ideas.

He urged students to be willing to spend money and time to help others, citing his and his wife’s initiative to use their wealth to promote equal opportunity and his own volunteer time.

Millennials have grown up in a connected world, he noted.

“In a recent survey of millennials around the world asking what most defines our identity, the most popular answer wasn’t nationality, ethnicity or religion,” he said. “It was citizen of the world. That’s a big deal. Every generation expands the circle of people we consider one of us. And in our generation, that now includes the whole world.”

Millennials can be the generation that ends poverty and disease, he said, urging students to build local communities. He cited churches, sports teams and music groups as institutions that help people find community.

That’s why it’s so striking, he said, that membership in communities has declined by as much as one-quarter. “That’s a lot of people who need to find a sense of purpose somewhere else,” he said.

He became emotional when he told the story of an immigrant who wasn’t sure he could go to college but wanted a book on social justice.

“He wasn’t feeling sorry for himself,” he said. “He has a greater sense of purpose, and he’s going to bring people along with him. … We owe it to the world to do our part, too.”

Julie Zauzmer contributed to this report.