The director of a National Oceanic and Atmospheric Administration division for predicting weather died Monday in North Carolina while swimming in dangerous conditions that federal forecasters had warned about.

William Lapenta, head of the NOAA‘s National Centers for Environmental Prediction, drowned Monday while swimming at Pelican Way beach in the town of Duck, according to a statement from the town's director of public information, Christian Legner.

An off-duty ocean rescue supervisor spotted Lapenta, 58, struggling in the ocean, and lifeguards responded within minutes to pull the scientist from the water, the statement said. He was unresponsive.

Emergency responders tried to save Lapenta, but he was pronounced dead at the scene.

"Monday’s surf conditions and a rip current in the area were likely a factor" in Lapenta's drowning, the town's statement said.

The National Weather Service, which oversees the National Centers for Environmental Prediction, warned earlier Monday of a high risk of rip currents along North Carolina’s Outer Banks, saying "the surf is dangerous for all levels of swimmers."

The town of Duck warned online early Tuesday of the dangerous conditions and said it had posted red "no swimming" flags.

The division that Lapenta directed is responsible for delivering "national and global weather, water, climate and space weather guidance, forecasts, warnings and analyses to help save lives and protect property," according to the NOAA.

He joined the NOAA in 2008 after spending two decades working as deputy manager of NASA's Science and Exploration Research Office, his NWS profile said.

"I am deeply saddened to learn about the loss of my friend and colleague, Bill Lapenta," NWS Director Louis Uccellini wrote on Twitter. "Bill was a brilliant scientist and mentor to many. He will be missed by all of us in the @NWS and @NOAA."

Lapenta is survived by his wife and two adult children.