North Korea's refusal to drop its nuclear weapons programme may have a lot to do with the fate that met another would-be nuclear power's dictator just a few years ago.
Pyongyang's ongoing development of nuclear weaponry - including the successful launch last week of a missile that could potentially reach the United States - has set off alarm bells across the international community.
But the insistence of North Korean dictator Kim Jong Un to keep building an arsenal could come from a lesson he learned from another one-time opponent of the West: Libya's Moammar Gadhafi.
Gadhafi conceded to Western demands that he give up his quest for nukes in 2003, only to be toppled by NATO and his Libyan opponents during a brief civil war in 2011.
North Korea isn't crazy. It's insecure, poor, and extremely dangerous North Korea isn't crazy. It's insecure, poor, and extremely dangerous.
Nobody likes Kim having nukes. He's an erratic leader whose weapons programs defy UN sanctions, and North Korea has repeatedly broken promises to stop developing them.
Worst of all, Kim likes to threaten to attack other countries, including Japan, South Korea, the United States and Australia.
But Kim likely sees the weapons as an insurance policy that keeps him in power.
There are uncanny similarities between his regime and Gadhafi's: The Libyan dictator had seized control of the state after leading a military coup in 1969.
Like Kim, Gaddafi ran a socialist dictatorship built on a cult of personality. Under Gadhafi, Libya earned a reputation as a rogue nation.
It consistently breached international norms, committing human rights abuses, funding terrorist groups, and proliferating weapons of mass destruction.
Yet, in a surprise move in 2003, Gadhafi agreed to give up his weapons programme and welcome international inspectors. In exchange, the US and its allies promised better relations with Libya and lifted long-standing economic sanctions.
Eight years later, NATO led a military intervention to support rebels trying to overthrow Gadhafi's regime.
NATO said it was responding to a United Nations call to end crimes against humanity in the country.
"North Korea (is) firmly in the belief that they need to have credible nuclear deterrent, and they believe that as a sovereign country they have the right to do so."
-Dr. Guo Yu, analyst, Verisk Maplecroft
Gadhafi was beaten and killed after he was chased down by rebel soldiers on October 20, 2011. His convoy had been bombed and scattered by US and French airstrikes only moments earlier.
Gadhafi holds the unfortunate (for him) distinction of being the only Middle Eastern national leader who was killed during the Arab Spring.
US President Barack Obama has called his failure to plan for the consequences of Gadhafi's downfall the worst mistake of his presidency. But he has said he still believes military intervention was the "right thing to do".
It's highly likely that Kim keeps Gadhafi's unfortunate end in mind, and it deters him and his North Korean leaders from surrendering their own nuclear weapons, according to experts.
"We see in Libya and Iraq countries who gave up their WMD programs, and foreign power campaigns that led to a regime change," said Dr. Guo Yu, principal Asia analyst at global risk consultancy Verisk Maplecroft.
"To safeguard against that, North Korea (is) firmly in the belief that they need to have credible nuclear deterrent, and they believe that as a sovereign country they have the right to do so."
Kim is also "watching what's been happening in the Middle East, and the external military interventions - mostly led by the US - which are interested in regime change and just reinforce the mindset for pursuing independent credible nuclear deterrence," Yu said.
During a visit to Libya's former colonial ruler Italy in 2009, Gaddafi remarked: "We had hoped Libya would be an example to other countries … But we have not been rewarded by the world."