Former Secretary of Defense Leon Panetta said Monday the unfolding debacle in Afghanistan was a "Bay of Pigs" moment for President Joe Biden, referring to the ill-fated, U.S.-backed effort to overthrow Cuban dictator Fidel Castro.

Biden has come under sharp criticism for the chaos unfolding in Afghanistan as the Taliban seizes control, and Panetta was asked by CNN's John King what this moment meant for the president.

"In many ways, I think of John Kennedy and the Bay of Pigs, you know?" Panetta said. "It unfolded quickly and the president thought that everything would be fine and that was not the case. But President Kennedy took responsibility for what took place. I strongly recommend to President Biden that he take responsibility and admit the mistakes that were made."

MAINSTREAM MEDIA CRUSHES BIDEN FOR ‘FLAT-FOOTED,’ ‘HUMILIATING’ BETRAYAL OF AFGHANS AS TALIBAN TAKES CONTROL

The 1961 Bay of Pigs invasion attempt was an early black eye for President John F. Kennedy, as well as a propaganda victory for Castro.

Biden will speak Monday afternoon on the deteriorating Afghanistan situation. Panetta, a Democrat who served in the Obama administration at the Pentagon and CIA, implored him to assure the U.S. and its allies that it would work to protect peace and prosperity.

"We have been through a difficult few days here in Afghanistan, and he's got to make clear to the American people that as commander in chief, he is going to continue to protect our national security and that we are going to go after terrorists wherever the hell they're at. He has just got to ensure that the United States of America remains a strong world leader that can work with our allies to try to protect peace and prosperity. That is the message he’s got to give the American people and the world, because our credibility right now is in question," he said.

FLASHBACK: BIDEN MEDIA ENDORSEMENTS IN 2020 TOUTED HIS ‘RICH GRASP’ OF FOREIGN POLICY

Biden is facing bipartisan criticism and media outrage over the catastrophic situation unfolding in the country following his U.S. troop withdrawal. He predicted last month the Taliban would not quickly take over the country following the U.S. exit and there would be "no circumstance where you see people being lifted off the roof of an embassy" such as during the infamous Saigon exodus in 1975.

CLICK HERE TO GET THE FOX NEWS APP

However, the Afghan government quickly collapsed, and the Taliban took back Kabul nearly 20 years after U.S. troops drove the Islamist terror group out of the capital in 2001.