John Kerry has a message for President Donald Trump: resign.

The former secretary of state and U.S. senator was speaking on a CNBC panel at the World Economic Forum in Davos, Switzerland, when he was asked what he wanted to tell the president. While he initially hesitated, telling the panel that Trump "doesn't take any of this seriously," he eventually offered up his suggestion.

"What would your message be?" CNBC's Tania Bryer, the panel's moderator, asked.

"Resign," Kerry replied. His response drew some laughter and applause from the audience.

Kerry served as secretary of state during the Obama administration from 2013 to 2017. Prior to that, he represented Massachusetts in the Senate for 28 years. The Democratic presidential nominee in 2004, he lost to then-President George W. Bush. He hasn't ruled out another bid in 2020.

At Davos, Kerry also blasted Trump's decision to pull out of the Paris climate agreement, which he signed while he was the country's top diplomat, saying that this would "cost lives."

"People will die because of the president's decision, and billions of dollars of damage will be done to property as a result of our not moving fast enough to do what is necessary to avoid the worst consequences," he said.

Additionally, when asked about the ongoing partial government shutdown, Kerry called it a "massive failure" of the U.S. democratic process and described it as "utterly disgraceful."

"It's embarrassing for our government, it's embarrassing for our country," he said.

Davos:Trump cancels US delegation trip to economic conference over government shutdown