SEOUL, South Korea — After years of effort to develop nuclear missiles that can target the U.S. mainland, is North Korean leader Kim Jong Un really ready to pack them away in a deal with President Donald Trump?

Perhaps, but that wouldn't necessarily mean Pyongyang is abandoning its nuclear ambitions entirely.

Tuesday's meeting in Singapore between Kim and Trump comes after a sharp turn in North Korea's diplomacy, from rebuffing proposals for dialogue last year to embracing and even initiating them this year. The change may reflect a new thinking about its nuclear deterrence strategy — and how best to secure the ultimate goal of protecting Kim's rule.

A look at how Kim's appetite for talks swung amid the North's ups and downs in weapons development and what that says about how he might approach his negotiations with Trump:

North Korea's attitude toward dialogue in the past two years has seemed to shift with setbacks or progress in its weapons tests.

Even after starting a rapid process of weapons development following a nuclear test in January 2016, Pyongyang constantly invited rivals to talks that year.

It proposed military meetings with Seoul to reduce tensions and indicated it could suspend its nuclear and missile tests if the U.S.-South Korean military drills were dialed back. Washington and Seoul demurred, saying Pyongyang first must show genuine intent to denuclearize.

At the time, North Korea's quest for a credible nuclear deterrent against the U.S. was troubled. The military conducted eight tests of its "Musudan" intermediate-range missile in 2016, but only one of those launches was seen as successful. The country's path toward an intercontinental-range ballistic missile appeared cut off.

North Korea's stance on dialogue changed dramatically, though, following the successful test of a new rocket engine in March 2017, which the country hailed as a significant breakthrough.

The engine, believed to be a variant of the Russian-designed RD-250, powered a successful May flight of a new intermediate-range missile, the Hwasong-12, reopening the path to an ICBM. That was followed in July by two successful tests of an ICBM, the Hwasong-14.

Pyongyang's demands for talks disappeared. Proposals to meet from a new liberal government in Seoul were ignored. Determined to test its weapons in operational conditions, the North flew two Hwasong-12s over Japan and threatened to fire them toward Guam, a U.S. military hub.

The North's state media brought up President Richard Nixon's outreach to Beijing in the 1970s following a Chinese test of a thermonuclear bomb, saying it was likewise inevitable that Washington will accept North Korea as a nuclear power and take steps to normalize ties.

Kim talked of reaching a military "equilibrium" with the U.S. By all signs, he was fully committed to completing an ICBM program he intended to keep.

Kim's turn toward diplomacy this year suggests he may have concluded the nuclear deterrence strategy was failing, some analysts say.

After a November test of a larger ICBM, the Hwasong-15, Kim proclaimed his nuclear force as complete, but his announcement may have been more politically motivated than an assessment of capability.

Although the Hwasong-15 displayed a greater range than the Hwasong-14, there was no clear sign the North had made meaningful progress in the technology needed to ensure that a warhead would survive the harsh conditions of atmospheric re-entry.

New U.S. National Security Strategy and National Defense Strategy reports released in December and January respectively also seemed to reduce the credibility of Kim's deterrence plans, said Hwang Ildo, a professor at Seoul's Korea National Diplomatic Academy.

In the documents, the U.S. assesses it could sufficiently defend against the small number of North Korean ICBMs — believed to be about 10 or fewer — with its 44 ground-based interceptors deployed in Alaska. Missiles fired from North Korea would have to pass Alaska to reach the U.S. mainland.

Experts are divided on whether the interceptors, which Washington plans to deploy in larger numbers soon, can be counted on to destroy incoming warheads. However, Hwang said, real capability doesn't matter as much as Trump believing that the system works, which reduces the bargaining power of the ICBMs.

Kim can't be the Mao Zedong to Trump's Nixon if the U.S. sees his weapons as containable. With North Korea's limited resources, as well as the threat of a pre-emptive U.S. attack, it's difficult for the North to mass produce enough ICBMs to overwhelm the interceptors in Alaska.

Rather than prolonging his nation's economic suffering, Kim may have concluded it would be better to deal away his ICBMs at the cusp of operational capability, especially when it was no longer clear the missiles would guarantee his survival.

"North Korea always tries to maintain flexibility and increase its options from step to step," Hwang said.

What never changes for North Korea is that the survival of the Kim regime comes first.

Nam Sung-wook, a North Korea expert at Seoul's Korea University, said Kim is probably modeling a nuclear future after Pakistan, which began building a nuclear arsenal in the 1990s to deter India. Pakistan is now estimated to have more than 100 warheads that are deliverable by short- and medium-range weapons and aircraft.

Kim may be seeking a deal where he gives up his ICBMs but keeps his shorter-range arsenal, which may satisfy Trump but drive a wedge between Washington and its Asian allies, Seoul and Tokyo. In drills with shorter-range weapons in 2016, the North demonstrated the potential to carry out nuclear attacks on South Korean ports and U.S. military facilities in Japan.

In negotiations, Kim may try to exclude submarine technologies from a freeze or verification process to leave open a path toward sub-launched ballistic missile systems, Hwang said.

Then, if diplomacy fails and Kim goes back to building nuclear weapons, the systems would expand their reach and provide a second-strike capability to retaliate if North Korea's land-based launch sites are destroyed.

North Korea successfully tested a submarine-launched missile that flew about 500 kilometers (310 miles) in August 2016. Analysts believe the solid-fuel missile can hit targets as far as 2,500 kilometers (1,550 miles) away.

That said, it would take years for the North to develop a fleet of submarines that can quietly travel deep into the Pacific.

The immediate outcome of the summit in Singapore is likely to be a vague aspirational statement on the North's denuclearization, Nam said. When it comes to details, Washington and Pyongyang are destined to "muddle through" a lengthy process, wrestling over the terms of monitoring and inspections, he said.

Still, such a process would halt the growth of the North's nuclear program and prevent it from using its weapons to flex its diplomatic muscle, Nam said. It could take a decade or so for Kim to find his next move in nuclear deterrence if he's eyeing a submarine-launched system. That could be enough time for Washington, Seoul and others to convince Kim he just can't win the nuclear game.