WYOMING, Ohio — Four years ago, Otto Warmbier stood in front of his graduating class at Wyoming High School as the salutatorian, smiling and chipper even as he lamented leaving the tight-knit community where he grew up.

"Many of us will move far away and not come back for a long time. ... Tomorrow morning we will all belong to another class, another job or another city. No matter where we go or what we do though, we will always have this group here," the then-18-year-old said.

The speech was imbued with a fresh-faced optimism, one that friends would later say was authentically Warmbier, who would go on to attend the University of Virginia and double major in commerce and economics.

On Thursday morning, those classmates and the larger community returned to Wyoming High School to honor Warmbier — and say a final farewell before burying the young man whose five-day trip to North Korea resulted in a 17-month imprisonment that ended in heartbreak.

"When you hear his speech as salutatorian and you hear him speak about where we're going, and where we're going to be and what we're going to do, it is somewhat foretelling," Lauren Wadds, whose children graduated from Wyoming High School, told NBC affiliate WLWT ahead of the funeral. "It brings me peace. That's what brings me peace about Otto."

Fred and Cindy Warmbier watch as their son's casket is placed in a hearse after his funeral on June 22 in Wyoming, Ohio. Bryan Woolston / AP

So many mourners turned up at the high school's arts center, with a capacity for 2,500, that the overflow had to be turned away, according to the station. Among those who spoke were his younger siblings, Austin and Greta, and friends.

"The message was taking all of the good things about Otto and paying them forward, if you will," Wyoming High School college counselor Cynthia Meis told NBC News about what was shared inside. "Being adventurous, being kind, being a student of the world, and using his life as an example for how we should all live our lives."

After the service, bagpipes blared as friends wearing blue ribbons carried Warmbier's casket out of the school and into a hearse, headed for the cemetery. Many left the school in tears.

PHOTOS: Thousands Mourn Otto Warmbier at Ohio Funeral

Warmbier had been remembered as a standout at Wyoming High School, where friends and staff said he had a disarming charisma and was comfortable around different groups of students.

He was the captain of the soccer team and taught young children how to swim. He was crowned homecoming king and prom king. He would extol the virtues of rapper Biggie Smalls. And he could quote the TV show "The Office." During his graduation speech, he fondly recited one character's line: "I wish there was a way to know you're in the good old days before you've actually left them."

Warmbier's death Monday after his surprise return last week from North Korea remains veiled in mystery.

By all accounts, he was healthy when he first visited the isolated nation in December 2015 as part of a Chinese-based travel tour — a stopover before he was set to begin his study-abroad trip in Hong Kong through UVA's McIntire School of Commerce.

North Korean officials accused him of trying to steal a propaganda banner from his Pyongyang hotel. As he prepared to depart from the airport, officers detained him. He was sentenced in March 2016 to 15 years of hard labor for "hostile acts" against the country.

Related: Will Otto Warmbier's Death Force Trump to Act on North Korea?

"I made the worst mistake of my life!" an emotional and tearful Warmbier blurted out during his one-hour trial — although it was not apparent whether his confession was coerced.

A display of Otto's belongings he had with him while traveling abroad at the funeral service of Otto Warmbier on June 22, 2017. He wore the jacket during his trial. Courtesy of the Warmbier Family

In the nerve-wracking months that followed, Warmbier's parents said there was no word from their oldest child. They didn't know he was suffering from brain damage, which the North Koreans said came after Warmbier contracted botulism and then took a sleeping pill, putting him in a coma.

Fred and Cindy Warmbier said they worked frantically with the Obama administration and other Washington lawmakers to get their son home. It wasn't until the North Koreans allowed Joseph Yun, the State Department's top official on North Korea, to fly to Pyongyang last week with a medical team and pick up the ailing Warmbier.

The North Koreans later said they released him — one of at least three known Americans detained there in recent years — on "humanitarian grounds." American doctors said they found no evidence of active botulism.

Related: Otto Warmbier’s Family Objects to Autopsy

"I'm proud of Otto and the courage he showed by going to North Korea and having that adventurous side to him," Fred Warmbier told reporters two days after his son's return to U.S. soil. "And so, the fact that he was taken and treated this way is horrible, and it's tough to process. But we're tremendously proud of him."

At UVA, Warmbier joined the Theta Chi fraternity. His college girlfriend, Alex Vagonis, said at a vigil held after his death that he "made life all the more beautiful."

"And it was not just my life he made more colorful, but everyone else's," she told the crowd.

Warmbier would have graduated this past May from UVA.

Mourners attend the funeral for Otto Warmbier. Courtesy of the Warmbier family

Meis, his high school college counselor, said it was a "stroke of luck" that she got to advise him during his senior year at Wyoming. She was struck by his ability to have mature conversations with adults.

"I've worked with teenagers my entire professional life, and I've never come across a young man as charismatic, as bright and as personable as Otto was," Meis said. "He was willing to set the world on fire."

Hundreds of people filed into Wyoming High School on Thursday to pay tribute to him, including Yun, who helped to free him, and Ohio Sen. Rob Portman. Three miles of the suburban Cincinnati town were lined with white and blue ribbons on the trees and gates.

Mourners line the street after the funeral of Otto Warmbier on June 22, 2017, in Wyoming, Ohio. Bryan Woolston / AP

"Each ribbon wrapped around a tree is like an arm wrapping around the Warmbiers," said Gretchen Tash, whose son is friends with Warmbier's younger brother.

The outpouring of love for him and the kinship felt in the Wyoming community led her to tears.

"Otto's legacy is that we get to live on with life," Tash added, "and to do any less than to celebrate it each day would be living it in vain."

Catie Beck reported from Wyoming, Ohio, and Erik Ortiz reported from New York.