Mark Zuckerberg grew emotional Thursday in a speech to Harvard grads as he recounted a conversation with a high school student who was also an undocumented immigrant.

Near the end of his speech, Zuckerberg's eyes teared up and his voice broke as he spoke of the student, who feared he would be deported.

"He wasn't sure if the country he calls home, the only one he's known, was going to deny him his dream of going to college" because of his immigration status.

"I can't even say his name because I don't want to put him at risk" of deportation, Zuckerberg said.

One of the world's richest people, the Facebook CEO spoke with admiration of the student's attitude in the face of his uncertain situation.

"Here is a young guy who has every reason to be cynical... (but) He wasn't feeling sorry for himself. He has a greater sense of purpose," Zuckerberg said, before adding:

"If a high school senior who doesn't know what the future holds for him can do his part to move the world forward," said Zuckerberg as he held back tears, "we owe it to the world to do our part too.

He concluded by adding: "Every generation expands the circle of who we consider one of us."

Earlier in his speech, Zuckerberg told the rain-soaked crowd that "finding your purpose isn't enough....The challenge for us is to create a world where everyone has their own sense of purpose."

Five years after he ruffled feathers on Wall Street by wearing a hoodie during meetings with prospective Facebook IPO investors, Zuckerberg donned a suit and tie and opened his remarks with a joke at his own expense.

"You all accomplished something I didn't" by graduating, said Zuckerberg, who dropped out to build Facebook into one of the world's most valuable companies.

He also said that the worst part of Facebook's early days occurred when someone tried to buy the company.

"That was the most difficult time," said Zuckerberg, because he refused to sell even though his co-founders and early investors wanted to accept an offer.

"One (company) adviser said: 'If you don't sell, you'll regret it for the rest of your life," he told the university's 2017 graduating class.

The resulting split in the company left him feeling isolated as he pursued his dream to build a great company.

"Everyone was gone...I felt alone...I felt like an impostor, a 22-year-old kid who didn't know how the world worked."

Today, Zuckerberg's net worth is estimated at roughly $72 billion.

As of last summer, the Harvard endowment fund was valued at $36 billion.

Watch: Zuckerberg on universal basic income