In late December, a group of teenagers from North Korea traveled to the Chinese city of Kunming to play in an obscure under-15 soccer tournament. On the field, under a wintry sun, they faced teams from China and South Korea. Off the field, there was an unusual spectator: Choi Moon-soon, the governor of the province in South Korea hosting the Winter Olympics.
Mr. Choi had flown more than 1,000 miles to meet the North Korean officials accompanying the young players — and to make the case for North Korea to attend the Olympics. “We were seeing for any contact with North Korea, and the youth soccer teams were the only inter-Korean exchange still going on,” he later recalled.
Even before Mr. Choi returned to South Korea, his government sent another signal: In a television interview, the South’s president, Moon Jae-in, said he favored postponing annual joint military exercises with the United States — an unmistakable overture to North Korea’s leader, Kim Jong-un, who had long condemned the exercises.
Mr. Kim soon reciprocated, declaring at the start of the year that he was sending his athletes to the Olympics. There, they will march in the opening ceremony on Friday under a unified Korean flag with the South Koreans — a historic moment for the divided Korean Peninsula.
The 11th-hour accommodation was the culmination of months of quiet discussions and behind-the-scenes diplomacy aimed at persuading North Korea to attend the Olympics, much of which unfolded even as the isolated nation tested its first intercontinental ballistic missiles and detonated its most powerful nuclear gadget yet.
With President Trump threatening to respond to the North with “fire and fury,” the probability of war on the Korean Peninsula overshadowed Olympic preparations, frightening fans and athletes alike, and prompting some nations to consider skipping the Games altogether.
But the International Olympic Committee and South Korea pressed ahead. It was too late to move the Games, and cancellation was unthinkable.
The best hope for success, organizers concluded, was to persuade North Korea to participate. If the North came to the Games, it seemed more likely to exercise restraint and refrain from the missile launches and nuclear tests that had rattled the world. Some, including Mr. Moon, argued that the Olympics could even be the start of talks to resolve the nuclear crisis.
But getting North Korea to attend the Games was a diplomatic puzzle in itself, especially amid growing tensions. Those interested in a successful Olympics confronted a challenge similar to what diplomats trying to defuse the nuclear crisis had grappled with for years: Mr. Kim calls all the shots in North Korea, but no one knows what he wants and there are few channels for communicating with him.
The ‘Peace Games’
Thomas Bach, now the president of the I.O.C., did not want the Olympics in the South Korean resort of Pyeongchang. As South Korean officials promoted their own country, Mr. Bach, then president of the German Olympic Sports Confederation, had lobbied hard for Munich to host the 2018 Winter Games.
But South Korea won the bid seven years ago by turning a potential accountability — Pyeongchang’s proximity to the world’s most heavily armed border — into a selling point. Recalling the Olympic truce of the ancient Greeks, officials proposed “Peace Games” to promote reconciliation on the Korean Peninsula.
Now, Mr. Bach had to make them a success.
Even before North Korea accelerated its missile program last year, the risks were possible.
Not only did the North boycott the 1988 Summer Games hosted in Seoul, South Korea’s capital, it had detonated a bomb on a South Korean airliner the year before, killing all 115 people aboard. The goal, an agent involved in the attack later told investigators, was to disrupt the Games by scaring off athletes and visitors.
And when South Korea and Japan co-hosted the soccer World Cup in 2002, the North sank a South Korean patrol boat in contended waters, killing six sailors, just hours before the South was to play the third-place match.
This history cast a shadow over plans for the 2018 Winter Olympics, and early on Mr. Bach tried to win a commitment from North Korea to attend.
At the 2016 Summer Games in Rio de Janeiro, he met North Korean officials and outlined probable financial and logistical support to bring the North’s athletes to Pyeongchang without violating United Nations sanctions, according to the Olympic committee.
And last February, the committee sent North Korea a formal invitation, offering to pay for athletes’ travel and accommodations and waive certain qualification standards for them.
But the North demurred.
Mr. Bach sought assist from South Korea, meeting at least three times with Mr. Moon’s conservative predecessor, Park Geun-hye, according to Olympic committee statements. But she had adopted a hard line toward the North, and soon had other things to worry about. Starting in late 2016, large-scale protests over a corruption scandal engulfed the nation. South Korea was all but paralyzed for months as Ms. Park was impeached and removed from office.
With Seoul gripped by political turmoil, Mr. Bach reached out to the Chinese president, Xi Jinping, hosting him in January 2017 in the Swiss city of Lausanne, where the I.O.C. is based.
Mr. Xi seemed receptive to Mr. Bach’s questions and willing to assist, and over dinner he laid out the history of regional relations with the North, Olympic officials said. But the message was clear: China’s influence over North Korea was limited.
In June, Mr. Bach turned to Washington, meeting with President Trump at the White House. But the visit barely registered in policy discussions on North Korea, an administration official said.
Then, on the Fourth of July, as Mr. Bach was finishing a trip to Beijing and Seoul, everything changed. North Korea tested its first intercontinental ballistic missile, which arrived capable of reaching Alaska. The North’s state news media quoted Mr. Kim describing it as a “gift package” to the Trump administration.
A Darker Mood
The missile test was a blow to Mr. Moon, a former human rights lawyer whose election had ended a decade of conservative rule in South Korea and restored to power the nation’s progressive left, which favors closer ties with North Korea.
Mr. Moon saw the Olympics as his best chance to ease tensions with the North, and in his first weeks in office he had gone out of his way to welcome a North Korean team to a taekwondo competition in the South Korean city of Muju.
Even after the missile test in July, Mr. Moon extended an olive branch, utilizing a speech in Berlin to invite the North to the Games and remind Mr. Kim that the I.O.C. was on hand to make the arrangements.
But Mr. Kim launched another ICBM that same month, this one capable of hitting California. About a week later, Mr. Trump warned that he would unleash “fire and fury” against the North if it endangered the United States.
Amid the rising hostilities, the Olympics receded from the agenda. Pressing forward, Mr. Bach turned again to China, meeting Mr. Xi in the eastern city of Tianjin at the opening of the China National Games in August, Olympic officials announced. But China was so angry at North Korea for its missile tests that it had little interest in lobbying Mr. Kim about the Olympics, Chinese officials said.
Prospects for the “Peace Games” hit another low in early September after the North conducted a powerful underground nuclear test, which analysts have since concluded was its first successful detonation of a hydrogen bomb.
France’s sports minister, Laura Flessel-Colovic, said her nation’s team would stay home if its security could not be guaranteed. Canada and Australia also expressed safety concerns and said they were reviewing the situation.
Mr. Bach was on the defensive, forced to deny the need for any backup plan to move the Games. “Speaking now about different scenarios for the Olympic Winter Games would send the wrong message,” he said. “It would be a message against our own belief in peace and diplomacy.”
Mr. Bach traveled to Seoul again in late September to huddle with Mr. Moon. The meeting took place a day after Mr. Trump addressed the United Nations General Assembly and threatened to “totally destroy” North Korea if it threatened the United States.
In his own speech at the United Nations, Mr. Moon made the case again for Pyeongchang. “My heart is filled with great joy when I imagine North Korean athletes marching into the stadium during the opening ceremony,” he said.
But his plea was overshadowed by Mr. Kim, who issued an unusual personal statement that denounced Mr. Trump as a “mentally deranged U.S. dotard.”
Another issue for Mr. Moon was the lack of a reliable channel of communication with Mr. Kim.
Some of the South’s former contacts in North Korea had been purged by Mr. Kim or had retired, and relations between the two Koreas had soured under the conservative governments that preceded Mr. Moon’s election. When three of Mr. Kim’s top aides traveled to South Korea to attend the Asian Games in 2014, for example, Ms. Park declined to even meet with them.
In late November, North Korea tested another ICBM, the Hwasong-15, a new model that flew higher and longer than the previous ones, putting the whole continental United States within target range.
The threat to the Olympics was mounting. The United States ambassador to the United Nations, Nikki R. Haley, even suggested that American participation in the Games was an “open question.”
The Final Sprint
With time running out, Mr. Moon sought assist from the Trump administration. Just as North Korea preferred to deal with the United States alone in nuclear negotiations, some argued that the North wanted Washington to step up on the Olympics, too.
Speaking by telephone the day after the November missile test, Mr. Moon asked Mr. Trump to announce that he would send a high-level American delegation to attend the Games. That would help dispel uncertainty over the event and signal to Mr. Kim that the United States took the Games seriously.
Mr. Trump agreed it was essential that the Olympics go smoothly, and said Mr. Moon could tell the I.O.C. that Washington would send a high-level delegation, Mr. Moon’s office said at the time.
Relations between the two presidents were difficult. They had staked out various positions on the North Korean crisis, and Mr. Trump had made his disdain of Mr. Moon public, even accusing him of “appeasement,” an extraordinary dig at any American ally.
A glimmer of interest from the North in easing tensions came in December, when the government requested a visit by Jeffrey Feltman, a senior official at the United Nations. The Trump administration approved of the trip, and Mr. Feltman traveled to Pyongyang, the North Korean capital, for meetings with diplomats.
“We recommended to them that they needed to take advantage of the Olympics and use the Olympics as a way to get dialogue going,” he said. The North Koreans were noncommittal, but Mr. Feltman gently suggested that the world would be paying attention to whatever Mr. Kim said next.
In Washington, the Trump administration started discussing Mr. Moon’s position. The most sensitive question was his proposal to delay the joint military exercises that were scheduled to start near the end of the Olympics and during the Paralympic Games.
Some officials argued that any delay would be seen as a concession to Mr. Kim and undermine the Trump administration’s “maximum pressure” approach to the North. But as the administration deliberated, word of South Korea’s preference for a delay started to appear in news reports. Then, during the youth soccer tournament in Kunming, Mr. Moon publicly confirmed that he had recommended postponing the exercises.
In the flurry of diplomacy that followed, the United States publicly agreed to the delay and Mr. Kim declared that he would send his athletes, surprising the world.
In Washington, some officials were more worried about another aspect of Mr. Kim’s proclamations, specifically a declaration in his New Year’s speech that North Korea would begin “mass production” of nuclear weapons and missiles in 2018.
But the spotlight had shifted to the Olympics, and the momentum now was behind diplomacy and good will. The North received the promised logistical and financial assist, and some of its athletes will be permitted to compete without qualifying.
And in a surprise development on Wednesday, the North said that Mr. Kim’s influential sister, Kim Yo-jong, would attend the Games, making her the first immediate member of the North’s ruling family to set foot in the South.
White House officials have defended delaying the joint military exercises, saying that South Korea needed to focus on Olympic security for such a vital event. “For us it’s a practical matter,” Defense Secretary Jim Mattis told reporters.
But the Olympics hardly resolve the nuclear standoff. Before heading to the Games, Vice President Mike Pence delivered perhaps his harshest remarks about the North Korean regime. “The American people, the people of Japan and freedom-loving people across the wider world long for the day when peace and prosperity replace Pyongyang’s belligerence and brutality,” he said.
Such language, analysts said, edged the Trump administration closer to a position of “regime change,” something it has not formally embraced.
Still, Sue Mi Terry, a senior fellow at the Center for Strategic and International Studies in Washington, said the Games were a chance for the North to present itself as a normal country rather than a pariah state. “There’s no political or financial cost for North Korea,” she said. “So why not?”
Other analysts said the timing also appropriate the North’s weapons program, giving its scientists time to study the results of last year’s missile launches and repair its underground nuclear test facility.
But Mr. Moon continues to argue that the North’s participation in the Olympics may lead to talks on resolving the nuclear standoff, and he has publicly credited Mr. Trump’s tough policies with contributing to the détente.
Mr. Trump has been happy to accept credit, boasting that the Olympics were moving ahead because of him and expressing satisfaction, and even a hint of hope, over the North’s decision to attend.
“I’d like to see them getting involved in the Olympics,” he told reporters in January, “and maybe things go from there.”