Viktor Moisa, a retired rocket scientist, welcomed the North Koreans to his institute in eastern Ukraine just as he would with any other guests. He took them upstairs to the showroom of Soviet satellites and rocket engines, the pride of the institute’s collection. Then they went out to the yard, where an array of parts for ballistic missiles were on display. This was in the early 2000s, well before North Korea would test its first nuclear bomb in 2006. So the visitors’ interest in missile technology did not arouse Moisa’s suspicion. “They came as tourists,” he told TIME on a breezy afternoon last fall. “At least that’s how they presented themselves.”

We were standing in the same yard he had shown to the North Koreans, a paved lot in the city of Dnipro where old missile components are still on show, many of them made at a nearby rocket factory known as Yuzhmash. Guidance systems, fuel pumps and the massive cones designed to hold nuclear warheads at the tip of a rocket all stood in the autumn sun like leftovers from a military rummage sale. Moisa, a cheerful 79-year-old with a puff of silver hair, says he understands in retrospect that his guests from North Korea were probably spies. “It’s just a guess,” he told me with a smile. “But they were probably dreaming of being a real missile power.”

That dream has since been achieved. Over the past eight months, North Korea has test-launched three rockets capable of striking the U.S. mainland. According to missile experts in the U.S. and Europe, the key components of these rockets are based on Soviet designs, much like those displayed in Moisa’s museum. The latest North Korean breakthrough, the Hwasong-15 missile, was tested in November; experts believe it could be powerful enough to lob a nuclear warhead all the way to New York City.

This feat of engineering, which only a few nations have ever achieved, exposed a long history of failures on the part of the U.S. and its allies. It showed that the strict sanctions they imposed on North Korea failed to isolate its military. It showed that North Korea, a country so poor that its cities go dark at night to save power, was still able to acquire some of the world’s most sensitive technology and hire experts who know how to use it. It showed that, despite decades of nonproliferation efforts, a rogue nation had obtained a weapon capable of starting World War III.

A 1952 nuclear detonation at the Nevada Proving Grounds, which Trump has ordered to prepare for resuming tests. Photograph by Bettmann Archive/Getty Images

Now, as the world adjusts to the reality of a nuclear North Korea, its young dictator Kim Jong Un has begun to sell this technology abroad. One of his most eager customers is the regime in Syria, which is also under strict international sanctions, according to a classified report that the U.N. Security Council is due to discuss at the end of February. A draft of the report, which was seen by TIME in January, suggests that Russia–Syria’s steadfast supporter–may be turning a blind eye to this trade while stonewalling U.N. efforts to investigate it.

As a permanent member of the Security Council, Russia has always denied such accusations. President Vladimir Putin insisted in December that he has tried to help the West in curtailing the spread of weapons of mass destruction. But in the same breath, he blamed the U.S. for leaving Kim no choice but to go nuclear. “For North Korea, this was the only way of self-preservation,” Putin said. “WMDs and missiles.”

Pyongyang’s weapons program had help from a variety of sources. The regime’s ability to enrich uranium, a key step in building a nuclear warhead, is believed to have come from Pakistan. But launching those warheads across continents would be impossible without Russian or Ukrainian technology, experts have concluded; and that, they say, is what allowed North Korea to become a truly global threat.

Starting in the early 1990s, the North Korean military methodically sought to assemble its weapons program from the ruins of the Soviet missile industry. The regime’s first team of foreign missile experts was recruited inside Russia, and recruitment efforts have continued in the decades since.

Such scientists, including experts in chemical, nuclear and biological arms, are not hard to find in Russia and Ukraine. By U.S. estimates, tens of thousands of them were left jobless after the Soviet Union fell apart. “And there were huge temptations for scientists to take some of their knowledge and potentially sell it elsewhere,” says former U.S. Ambassador to Ukraine Carlos Pascual, who headed the Russia desk at the White House in the late 1990s. “Given what was at stake, and what the cost of that knowledge leaking out might be, I think few had a clear understanding of how important this was.”

The warning signs look painfully clear in hindsight. As early as 1991, and as recently as 2011, North Koreans were caught trying to acquire Soviet-era missile technology, which has not always been kept under lock and key. In 2002, six tons of components for a Soviet ballistic missile turned up in a Ukrainian scrapyard. In another case in Russia last summer, two sets of surface-to-air missiles were found in a garbage dump in eastern Siberia.

Among the experts studying North Korea’s newest rockets, the first to raise the alarm over their Soviet origins was Michael Elleman, a former U.N. weapons inspector and consultant to the Pentagon. He had seen many of these weapons up close over the years. After the fall of the Soviet Union, he took part in U.S. programs to dismantle some of the largest missiles in the Russian stockpile, and he understood how easy it would be for this technology to leak. “As a proliferation risk,” he told me, “this has never really gone away.”

That seemed clear from North Korea’s latest missile launches. At his think tank in London, the International Institute for Strategic Studies, Elleman compared footage of those launches shown on North Korean television in July with photos of Soviet missile engines dating to the 1960s. One of them appeared to match the RD-250, an outdated but highly reliable machine.

Roughly 200 of these engines still exist, according to Yuzhmash, the missile factory in Dnipro that made them. Nearly all are stored in Russia, but Elleman concluded that if one had been stolen, it would more likely have been from a smaller stockpile in Ukraine. He pointed in particular to Yuzhmash itself, which was known to have been a target of North Korean spies not posing as tourists. Two of them were arrested in Ukraine in 2011 while trying to purchase copies of the factory’s designs; both are now serving eight years in prison for espionage.

In some ways, the plant was an obvious target. Founded during World War II to help the Red Army defeat the Nazis, it went on to develop many of the Soviet Union’s most powerful ballistic missiles. When TIME visited Yuzhmash last October, we were greeted by the sight of a missile code-named “Satan,” which was once capable of orbiting the earth and, at Moscow’s command, dropping a hail of nuclear warheads on its target. “This was our pride,” says Vladimir Platonov, the factory’s in-house historian. “We kept the Americans up at night.”

But the end of the Cold War made such weapons seem unnecessary. Under pressure from the U.S. and Russia, Ukraine agreed in 1994 to give up the arsenal of nuclear warheads it inherited from the Soviet Union. It also pledged to disarm the ballistic missiles meant to carry those warheads. For the cause of global disarmament, this was a breakthrough. For Yuzhmash, it was a disaster. Thousands of its engineers lost their jobs as the state’s demand for missiles dried up. Today the factory makes tractors and trolley buses to make ends meet. What rockets it still builds are intended to launch satellites into orbit.

Traditionally, its most reliable customer for these rockets has been Russia. But the conflict that broke out between the two countries in 2014 severed many of the economic ties between Russia and Ukraine, especially in sensitive fields like rocket technology. Yuzhmash fell on even harder times, slashing wages, rationing electricity and laying off the bulk of its staff. “It was a question of survival for us,” says Oleg Lebedev, the factory’s chief of production.

Engineers assemble a rocket at the Yuzhmash factory in eastern Ukraine Maxim Dondyuk for TIME

It’s not hard to see how these troubles made the factory more vulnerable to theft, Elleman said. “A small team of disgruntled employees or underpaid guards … could be enticed to steal a few dozen engines,” like the RD-250, he wrote in a report that was published in August. These machines, he added, “can be flown or, more likely, transported by train through Russia to North Korea.”

The report put Ukraine’s government on the defensive, and it scrambled to find all the ballistic-missile engines stored inside the country. In little over a week, it tracked down about a dozen RD-250s, nearly all of them stored at Yuzhmash, and announced that the investigation was closed.

But what the commission did not examine was the risk of the weapons scientists finding their way to North Korea. According to Lebedev, who took part in the investigation on behalf of Yuzhmash, the size of the factory’s workforce shrank sixfold between 2014 and 2017. “We’re talking about thousands of workers,” he says. “Everyone from the welders on the factory floor to the top engineers in our design bureau. We lost them all.”

The impact was obvious when Lebedev showed TIME around the missile factory. Its main production hall was almost deserted. About a dozen workers busied themselves inside a few space rockets, each one about the size of a jumbo jet. There was not a computer in sight. All measurements were done by hand, and elderly women in heavy coats noted them down in paper ledgers.

Yuri Simvolokov, a union organizer who has helped Yuzhmash workers stage strikes over unpaid wages, says many of them have gone abroad to find work over the years–not just to North Korea, but also to Iran and Pakistan. “They pay big money over there,” he says of these countries, over dinner with a few of his fellow teamsters. “And if they want to build a rocket, they bring our specialists over. It’s nothing new.”

In fact, the exodus began decades ago. In April 1991, as the Soviet Union was dissolving, a specialist in solid-state physics named Anatoly Rubtsov was approached by a group of North Koreans at an academic conference in Beijing. He had worked for years at a top-secret facility in southern Russia, producing intermediate-range missiles for the Soviet arsenal. But his loyalties seem to have flagged as his nation fell apart, and he became one of North Korea’s first known recruits from the former Soviet Union.

The North Korean offer, compared with Rubtsov’s prospects back home, must have seemed like a saving grace. As he later explained in interviews with Russian and Western reporters, he was invited to set up a research institute in North Korea and staff it with Russian engineers. Their aim would be to establish the regime’s missile program, according to Rubtsov’s own published accounts. But it didn’t stay secret for long. On Oct. 15, 1992, about 60 of his recruits were detained at a Moscow airport, and news of their plans caused an international scandal. Under pressure from the U.S. and South Korea, the Kremlin agreed to prevent Russian scientists from working on the North Korean missile program.

Pyongyang took this as a sign of betrayal. The regime’s relations with the Soviets had always been comradely. The founder of the dynasty that still rules North Korea, Kim Il Sung, was installed in power by the Soviet military in 1945 on the direct orders of Joseph Stalin, and the Soviets provided Kim with the tanks and artillery he used in 1950 to invade South Korea.

In 1961, Moscow signed a treaty of mutual defense and cooperation with Pyongyang. The agreement obliged the Soviet Union to defend the Kim regime if it ever came under attack. But President Boris Yeltsin and his band of reformers had no intention of honoring that agreement after they took power in Russia in 1991. “We had a different understanding of that responsibility,” says Georgy Kunadze, who as Russia’s Deputy Foreign Minister for Asia was dispatched to Pyongyang to explain how Russian thinking had changed.

He understood upon arrival that the North Koreans felt abandoned by Moscow. Their subsequent push to build a nuclear weapon was, to a large extent, driven by a resulting sense of insecurity, Kunadze says. During his meetings in Pyongyang, he asked that North Korea stop inviting Russian scientists to build their arsenal for them. “They gave some mild assurances, and that was that,” he says.

These assurances meant little in practice, as did Russia’s attempts to stop its scientists from going to work where they pleased. In a recent interview, the prominent missile designer Yuri Solomonov admitted that Russian scientists did wind up working on the North Korean weapons program in the 1990s. “They took the bait,” he told the state-run newspaper Rossiyskaya Gazeta in December.

Kunadze, who went on to serve as Russia’s ambassador in South Korea, says there was little the government could do to stop them. “Russia at the time … was a total mess,” he says. “Nobody had any money. The borders were open.” And the Russian scientists who traveled to North Korea were not in violation of any Russian laws. “So all we could do was reason with them,” says Kunadze. “In the end, it was their choice.”

The most immediate impact of the Rubtsov scandal was the alarm it caused in Western capitals, which were forced to realize the potential danger of an unchecked Soviet brain drain. The U.S. and Europe responded in 1993 by throwing money at the problem. Acting in sync with partners in Europe and Canada, the U.S. set up two organizations that year, one based in Moscow and the other in Kiev, with the aim of giving tax-free grants to scientists in Russia, Ukraine and other formerly communist nations.

“Our goal was never to fund science,” says Curtis Bjelajac, the director of this operation in Kiev, which is called the Science and Technology Center in Ukraine. “The whole thought process behind the STCU was, It’s a handout.” By his estimate, between 15,000 and 20,000 experts in weapons of mass destruction were left jobless in Ukraine alone after the fall of the Soviet Union. The number in Russia was likely far higher. Most of them were middle-aged or elderly. So the aim was to keep them busy until they either transitioned to work in the private sector or grew too old to go abroad.

Initially, it worked. At its peak around 2003, the programs in Moscow and Kiev were jointly giving out some $100 million per year in the former Soviet Union. This lifeline did not simply make the difference between a steady income and abject poverty for researchers across the region. It also nurtured their dignity by allowing them to continue working in their fields, says Dimitry Bazyka, one of Ukraine’s leading experts in nuclear technology. “It gave us a reason to value ourselves,” he says.

His nuclear institute still functions today with Western support, but it is a shoestring affair. Its campus abuts an outdoor bazaar in eastern Kiev full of kebab shops and peddlers of bric-a-brac. The entrance to the compound was so hard to find amid the maze of alleyways and vendors that I ended up climbing over a fence to get inside. No one stopped me.

Rocket parts await assembly at Workshop 97 of the Yuzhmash plant Maxim Dondyuk for TIME

Scientific institutes in Russia have generally fared better, but their record of security is mixed at best. In the winter of 2011, two bloggers found a way to sneak into one of Moscow’s most secretive missile factories, Energomash, and spent several nights photographing its technology. They did not encounter a single security guard. Although highly embarrassing for Russia’s missile industry, the incident did not make many headlines in the West, where terrorism and the wars in the Middle East had eclipsed other security concerns in the early 2000s. Public interest in the safety of Soviet-era weapons technology dwindled, as did support for obscure programs like the STCU. “Our donors concluded that the threat from weapons scientists had been contained,” says Bjelajac. But Serhiy Komisarenko, one of Ukraine’s leading experts in biological weapons, said the money was never enough to cease the flow of personnel. “The temptation to go abroad was always intense,” he said. “And it still is.”

Whether any of Ukraine’s impoverished scientists have gone to work in North Korea is difficult to prove. In eastern Ukraine, one rocket scientist agreed through an intermediary to discuss his work in Pyongyang with TIME, but then changed his mind at the last minute and refused to meet me. It’s hard to blame him. With the renewed concern over technology leaking out, Ukraine’s security services have stepped up monitoring of former weapons scientists. Those caught selling their expertise abroad could face charges of treason.

The U.N. panel of experts on North Korea has not found anyone either. In preparing its latest report to the Security Council, the panel sent inquiries to Russian officials, asking for the names and passport numbers of any weapons scientists who might have passed through Russia on their way to Pyongyang. They received no response, according to the draft of their report. In some sense, the silence was typical of Russia’s two-faced position on the issue. Throughout his 18 years in power, Putin has supported or acquiesced to U.N. sanctions that have sought to isolate the Kim regime. But he has also offered Pyongyang ways to escape that isolation.

Less than two months after Putin took power in 2000, Russia signed a treaty of friendship and co-operation with North Korea, reviving many of the diplomatic ties that bound Moscow to Pyongyang during the Cold War. A few months later, Putin became the first Russian or Soviet leader ever to pay an official visit to North Korea. “That totally revitalized our relationship,” says the former Russian diplomat Konstantin Pulikovsky, who helped steer Moscow’s relations with Pyongyang. “The main thing was the personal rapport between the two leaders.”

The second tyrant of the ruling dynasty, Kim Jong Il, had an even deeper connection to Russia than did his father. He was born in the Soviet Union, in a dirt-road village called Vyatskoe, where he lived for the first few years of his life under the name Yuri Irsenovich Kim. During that first meeting with Putin, he made no secret of his nuclear ambitions. “He told me back then that they have an atom bomb,” Putin recalled during a televised interview last October. “And more than that, he said they could use some pretty basic artillery to launch it all the way to Seoul.”

That first impression has not discouraged Putin from building bridges to the Kim regime. Even amid the spate of new missile tests over the past year–and the new U.N. sanctions imposed on North Korea in response–Moscow has continued to assist Pyongyang in crucial ways. A major Russian telecommunications firm provided North Korea with a new link to the Internet in October, relieving it of its dependence on China’s fiber-optic cables. Around the same time, North Korean ships were spotted picking up loads of fuel in Russia and, despite a tightening international oil embargo, bringing it back to their homeland.

The factory’s old missile workshops now produce rockets that launch satellites into orbit Maxim Dondyuk for TIME

For Putin, there would seem to be little obvious upside in nurturing this friendship. His country shares a border with North Korea, whose refugees would likely pour over the so-called Bridge of Friendship into Russia if a war ever broke out. A nuclear explosion in the area would also put Russian citizens in serious danger, especially in the nearby city of Vladivostok.

But Putin’s thinking goes beyond such immediate considerations, says Kunadze, the former Russian diplomat. Only in the broader context of Russia’s rivalry with the West does it start to make sense. “In that context, North Korea is the enemy’s enemy,” Kunadze says. “It keeps the U.S. distracted. And that’s valuable in itself.”

Whether it is valuable enough for Putin to arm North Korea directly–or turn a blind eye to smugglers who are seeking to do the same–remains an open question. The most likely players in this trade have so far tended to blame each other: Ukraine insists that Russia is the source of North Korean arms, and Russia points the finger at Ukraine.

As we stood among the old missile parts on display outside his institute in Dnipro, I asked Moisa, the former rocket scientist, whether the blame could be so neatly apportioned. He pointed at an RD-250 engine next to us. It had been in that spot for more than two decades, he said, exposed to the elements, yet it had no obvious corrosion or other damage. “That was the quality of what we made back then,” he said proudly. “I can tell you, it took a lot of work, a lot of people and a very long time.” In order to clone this technology, he added, the North Koreans would need many years to master the materials and the science involved.

And if the North Koreans had a team of Soviet-trained professionals helping out? Moisa smiled again and looked at the engine. “We could do it in a year and a half.”

This appears in the February 12, 2018 issue of TIME.

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.