Jimmy Fallon was a surprise commencement speaker Sunday for the graduating class of Marjory Stoneman Douglas High School where former student Nikolas Cruz killed 17 people in February.

>> Read more trending news

Moments before the seniors were to rise to receive diplomas, Fallon was ushered on stage by Principal Ty Thompson.

Fallon's commencement address lasted approximately 10 minutes, according to The Palm Beach Post.

“The world has heard your voice,” Fallon said.

Fallon joked that the students “won’t be classmates any more. You’ll be adults who will Facebook search each other at 2 in the morning for the next 10 years.”

Turning more serious, he said: “First thing is this: When something feels hard, remember that it gets better. Choose to move forward. Don’t let anything stop you.” He thanked them for their bravery and activism.

He finished by saying, “You’re not the future. You are the present.”

Four families received diplomas on behalf of loved ones slain in the attack that gave rise to a campaign by teens for gun control. Principal Ty Thompson underscored the honors for the dead students in a tweet.

“Remember those not with us, and celebrate all the successes the Class of 2018 has brought to the community and the world!” Thompson tweeted.

The private ceremony for the nearly 800 members of the Marjory Stoneman Douglas High School class of 2018 was held at the BB&T Center in Sunrise, Florida. It was moved to the arena to accommodate the expected large crowd.

Reporters were not permitted inside the arena.

Fourteen students and three staff members died in the Feb. 14 attack in Parkland. Former student Nikolas Cruz is charged with their deaths and the wounding of 17 other people. Attorneys for the 19-year-old have said he will plead guilty in exchange for a sentence of life without parole. Prosecutors are seeking the death penalty.

The Associated Press contributed to this report