Those demands, Mr. Heo says, were just one source of stress that began to build as the months in China went on. He also began to hear that friends in North Korea were being sent to prison camps, caught up in a wave of purges.

He said he was becoming disenchanted with his country’s system — and interested in South Korea’s. He says he began to nurture a dream of working for the South, and ultimately for Korean reunification.

Switching Sides

One day in 2014, he says, he approached one of the restaurant’s regular customers, an ethnic Korean Chinese man who seemed to know an interesting variety of people. Cautiously, he said, he asked the man if he knew anyone who worked in South Korean intelligence.

The contact put him in touch with a man who, after a series of conversations, identified himself as a National Intelligence Service officer. By 2015, Mr. Heo said he was giving that officer information about North Korea’s missile and submarine programs, which he obtained from friends among the North Korean elite. And he had signed a pledge of loyalty to South Korea.

The arrangement went on for months, he says. Then trouble came from an unexpected source. The customer told Mr. Heo that he knew about his espionage and he demanded $100,000 for his silence.

He pressed his demands so insistently that Mr. Heo moved the waitresses to the city of Ningbo near Shanghai to work in another restaurant, hoping to evade him. But the customer showed up there, too, he said.

It seemed only a matter of time before he would be exposed. In early 2016, he began pleading with the South Korean intelligence officer to help him get to South Korea. They discussed May 30 as a target date.