South Korea has reversed its decision to scrap a military intelligence-sharing agreement with Japan, hours before the move was to become official at midnight Friday. South Korea had said in August that it would leave the pact, after Japan removed the country from its "whitelist" of favored trade partners.

The eleventh-hour reversal salvages a 2016 pact brokered by the Obama administration that has allowed South Korea and Japan to share valuable information about their neighbors, most notably North Korea and China.

"Six hours before the pact was due to expire, Presidential National Security Deputy Director Kim You-geun told reporters that Seoul would remain in the pact for now but could leave at any time," NPR's Anthony Kuhn reports from Seoul. "The U.S. sees the General Security of Military Information Agreement, or GSOMIA, as essential to dealing with nuclear and missile threats from North Korea."

South Korea's pivot on GSOMIA follows progress on trade, with Japan agreeing to resume talks about export controls and Seoul pledging to drop a World Trade Organization action against Japan.

The U.S. has been urging its two close allies to preserve the deal and tone down their disputes, which are rooted in lingering disagreements over Japan's decades-long colonization of Korea and its occupation of the country during World War II.

As NPR has reported:

"A South Korean Supreme Court ruling last year allowed Korean victims of forced labor during World War II to seek compensation from Japanese firms. South Korea also shut down a Japanese-funded foundation that supported Korean comfort women who were forced into sexual slavery during the war. Both actions incensed the Japanese government."

As the U.S. worked to preserve the intelligence pact, Secretary of Defense Mark Esper visited South Korea and spoke with President Moon Jae-in about GSOMIA last week. Secretary of State Mike Pompeo also discussed the deal with his South Korean counterpart, Foreign Minister Kang Kyung-wha, on Thursday night.

Kang arrived in Japan on Friday night for the Group of 20 meeting of foreign ministers, which is being held on Friday and Saturday in Nagoya.

Moon's decision to leave GSOMIA has been a polarizing issue in South Korea, where protesters demonstrated both in favor of and against the deal. The president's critics are now saying Moon gave in to U.S. pressure to mend ties with Japan.

"Washington says that it is a matter for the two countries to settle, but its demand that Seoul remain in the GSOMIA falls nothing short of taking sides with Tokyo," opinion columnist Oh Young-jin writes in The Korea Times.

As news of the partial thaw emerged, South Korea's Yonhap news agency reports that Moon and Japan's Prime Minister Shinzo Abe "may hold one-on-one summit talks" next month.

Copyright 2019 NPR. To see more, visit