It’s the near future, and North Korea’s regime is on the brink of collapse. As rumors swirl of palace coups, forces on both sides of the world’s most militarized border are on heightened alert. The U.S. military faces a much bigger problem. Somewhere in the Pacific, a North Korean submarine is believed to be carrying nuclear warheads and the missiles to deliver them. And nobody knows where it is.

It sounds like the plot of a “Hunt for Red October”-style techno-thriller. But if Pyongyang’s technicians continue at their current pace, experts say it is becoming ever more likely.

One thing is certain: North Korea is plowing considerable resources into building its nuclear capability. And it is clearly making progress — even if the recent failed missile test shows it still has a long way to go.

Japanese officials said what appeared to be a conventional Musudan rocket, which theoretically has the ability to reach Japan and Guam, exploded either as or shortly after it left its launcher. North Korea is estimated to have some 20 to 30 of the missiles, which were first deployed in 2007 but have yet to be launched successfully.

What North Korean leader Kim Jong Un wants, most analysts believe, is simple — a rocket that can deliver a nuclear warhead at least on a regional target. His ultimate ambition, however, is to be able to hit U.S. cities on the West Coast, most likely from a submarine that could hide itself at sea.

North Korea has been steadily improving its rockets — which can also carry conventional explosives — for decades. It detonated its first nuclear device in 2006, but most experts believe it has yet to build one small enough to be placed on a missile. Having the credible ability to do all of that and get the missiles to sea could take well over a decade, perhaps considerably more.

Once it happens, however, it will be a strategic game changer. At worst, U.S. cities on the West Coast would have to deal with the prospect, however remote, that they might be struck by a North Korean atomic weapon. At the very least, a North Korea armed with nuclear submarines would hugely complicate the calculus for any U.S. president handling a crisis on the Korean Peninsula itself.

That, of course, is exactly the plan.

The fact that Pyongyang has conducted so many tests this year, some experts believe, suggests Kim is pushing his scientists harder than ever to deliver working rockets and warheads. North Korea is believed to have tagged the expertise of Russian Cold War-era scientists, and while its capabilities on both fronts lag well behind established nuclear states such as Russia and China, it is already believed to be well ahead of Iran.

In April, South Korean and U.S. officials said a North Korean submarine successfully launched a ballistic missile that traveled around 29 km — a major step forward.

Technical experts say TV footage appeared to show a solid fuel rocket successfully launching from underwater, essentially the same system used by Western forces to achieve the same goal.

When she testified before the Senate Armed Services Committee in April, the incoming head of the U.S. Northern Command — responsible for defending the mainland United States — delivered a stark warning.

“The North Korean threat is real,” U.S. Air Force Gen. Lori Robinson — previously head of U.S. air forces in the Pacific — told lawmakers. “For now, it’s a medium range, but they are trying very hard to be able to hit the homeland.”

It’s impossible to know exactly how much money and expertise the North Koreans are expending. The scale of the effort, however, is seen as large — in many ways, the same level of commitment the U.S. gave to the Manhattan Project to build the world’s first atomic bomb during World War II. Pyongyang’s reason is clear: building that kind of credible ability to strike is seen as central to the long-term survival of the Kim dynasty and its ruling party.

Last month, at the first meeting of its ruling party in 36 years, Kim said North Korea was a responsible nuclear weapons state and would never use its weapons — unless it were threatened. That seemed a clear warning to outside powers, particularly Washington, to steer clear of any attempts to destabilize or attack the regime.

Getting a submarine-based deterrent would be a very big deal — and not just because it might allow the North Koreans to move the launch point much closer to the target. Submarines are central to what nuclear weapons states call a “second strike” capability, the ability to launch missiles even in the aftermath of an overwhelming and perhaps surprise pre-emptive attack.

The U.S., Russia, Britain and France all retain what they call a “continuous at sea deterrent,” at least one submarine offshore at all times ready to fight back even if the homeland and all other military forces are completely taken out. Israel is also believed to have the ability to mount nuclear cruise missiles on its Dolphin-class conventional submarines, while China is now moving quickly toward new ballistic missile submarines for its own at sea deterrent.

This technology isn’t new — the U.S. and Russia developed it in the late 1950s, based in part on plans originally developed to hit German U-boats in the dying days of World War II. There is no good reason it should not eventually work for North Korea, too.

If and when it does, Pyongyang is likely to try to keep its submarines very close to its coasts — and its home defenses — at first. Still, once the first nuclear-armed submarine exists, Japan and the U.S. might feel political pressure to destroy it.

That would come with considerable risks. The North is known to have huge volumes of conventional artillery based along the South Korean border, much of it in range of Seoul and its 10 million residents. The risk of those weapons inflicting massive casualties is one of the key factors that has deterred multiple U.S. administrations from considering the kind of pre-emptive strike on Pyongyang’s weapons programs that the U.S. has threatened against Iran. The Korean War — frozen by the 1953 ceasefire but never otherwise resolved — may not be over yet.

Peter Apps is executive director of the think tank Project for Study of the 21st Century.