Students listened to their valedictorian in the rain, before lightning caused the ceremony to be moved inside.

Faculty and students at the Urban Assembly New York Harbor School believe in the Scandinavian saying: There’s no such thing as bad weather, only bad clothing.

For four years, members of the class of 2012 endured classes in the rain, snow, and sleet as they learned the ins and outs of marine biology and ship engineering through sailing and diving in the New York Harbor.

But that didn’t stop a severe thunderstorm from interrupting their graduation Friday, which was held outside the small public high school’s campus on Governors Island.

When lightning struck yards from where the ceremony was being held, Principal Nate Dudley helped direct an evacuation of the area. Students, teachers, and families fled to shelter in a tunnel in a nearby building, crying young siblings in tow, then waded through ankle-deep puddles to the school’s dining hall. They quickly dismantled tables that had been set for a senior banquet, and the ceremony resumed where it left off, in the middle of the valedictorian Cesar Gutierrez’s speech.

Dudley said that efficiency and resiliency represents the Harbor School. ”We roll with whatever happens to make our programs work,” he said.

Dudley, too, was graduating, after overseeing the school since it opened in Bushwick in 2003. This summer he is leaving Harbor School to become a deputy leader in one of the networks that the Department of Education runs to support schools. He’ll also continue working toward a doctorate in education leadership at Seton Hall University.

During Dudley’s time at the school, it moved from a shared building in the Bushwick section of Brooklyn to its current location on Governors Island, where it has a state-of-the-art facility. This fall, the school will open a marine and sciences technology center, paid for with $4 million raised through public money, including grants from the city council, and private donations.

“For a small public school that’s 70 percent free and reduced lunch to raise $4 million — I want to see any other school do that,” Dudley said.

Although Dudley is proud of the school’s big-picture accomplishments, such as mass fundraising and saving oysters unique to New York, he said he was most proud of the students as individuals. As he walked through the halls before graduation, he stopped to high-five or hug every student, teacher, or parent he met.

“Your daughter’s achievement was one of the highlights of my life,” he said to a father. “Not my career — my life.”

Students said they were happy to share the spotlight with their principal, whom they consider a father figure — albeit one who berates them for being late to class. Many students wore sunglasses to the ceremony, despite the cloudy conditions, because they knew tributes to Dudley, as well as their classmates, would make them tear up.

Dudley with the class of 2012 before the ceremony — and the storm.

“He’s a large part of the reason we work so well as a community,”  said Christopher Lorient, who is attending Roger Williams University on a full academic scholarship in the fall. ”I like that it feels like he’s graduating with us.”

Dudley was honored with a scholarship established in his name that will be given each year to a graduating senior who has faced adversity. And he said he hopes to stay involved with the school as a board member, especially as the school navigates its 10-year-plan to add more facilities and possibly expand into a middle school.

He and the 74 students who graduated Friday said they will miss the daily ritual of the ferry ride to and from Governors Island everyday.

Graduate Pamela Riera said the ferry ride facilitated a close-knit community.

“You share that experience of getting to school at the same time, leaving from the same ferry, the same place,” Riera said.

But for Dudley — who took an earlier ferry than his students each day — the ride represented a chance to meditate.

“I will miss my morning ritual of the sun coming up over Brooklyn, with the Statue of Liberty on starboard side and the city on port side, and Governors Island and the Harbor School, straight ahead,” he said.