In a dramatic last-minute about-face, the South Korean presidential office announced Friday that it will reverse course on its earlier decision to end a key intelligence-sharing pact with Japan — just hours before the expected expiry of the deal.

The announcement by Seoul, which saved the General Security of Military Information Agreement (GSOMIA) — at least for now — came in the face of strong and persistent pressure from the United States to keep it alive.

Washington demanded that Seoul renew the pact, which is widely regarded as a symbol of the military cooperation between South Korea, Japan and the U.S. against North Korea.

Observers say Seoul’s scrapping of the pact could have further escalated diplomatic disputes between South Korea and Japan, drawing the two countries into an even larger diplomatic row.

Still, the wartime labor issue involving Japan’s 1910-45 colonial rule of the Korean Peninsula, which Tokyo has prioritized most, remains unresolved.

Later in the day, Foreign Minister Toshimitsu Motegi told reporters in Nagoya that Tokyo’s priorities remain unchanged and that Seoul must “eliminate the current situation that violates international law.”

A key condition for Seoul is that South Korea can terminate GSOMIA at any time, the Yonhap news agency quoted Kim You-geun, deputy director of the presidential Blue House’s national security office, as saying at a news conference.

According to Yonhap, the presidential office of South Korea said it made the decision after the two countries closed the gap on some differences in their monthslong trade fight.

However in Nagoya, Motegi emphasized that the trade issue and the military pact are two separate things. Seoul probably reached the decision because it attaches much importance to cooperation between South Korea, Japan and the United States to cope with the North Korean military threat, Motegi said.

Meanwhile, despite Motegi’s comments, the Japanese trade ministry announced it will resume talks between export control officials of the two countries that have not taken place in over three years, a possible sign of progress in easing a trade dispute that further strained bilateral relations.

Yoichi Iida, the director-general of the trade control department at the Ministry of Economy, Trade and Industry, insisted Friday evening the decision is not related to the GSOMIA announcement.

He also confirmed that South Korea had suspended a bilateral consultation with Japan in the World Trade Organization’s dispute settlement process.

Japan this summer hit South Korea with enhanced screening on three chemicals integral for semiconductor manufacturing as well as a diverse range of materials that could be used to make weapons. South Korea fought back, downgrading its trade status with Japan in retaliation and condemning the move as politically motivated.

Iida said Japan is not planning to ease its tightened export control measures anytime soon.

“Considering South Korea’s notification on suspending the WTO process, we determined that South Korea is expressing its eagerness to improve its current export control problems.”

On Friday, officials of the two countries reportedly continued behind-the-scenes talks over Seoul’s planned withdrawal from the intelligence-sharing pact.

If talks had broken down over GSOMIA, the two Asian countries would have lost a precious opportunity to improve their strained bilateral ties.

Seoul announced in August it would scrap GSOMIA, a move that was widely seen as retaliation against Tokyo’s introduction of the export control measures.

Meanwhile, U.S. officials have repeatedly warned the scrapping of GSOMIA would weaken the trilateral military alliance and only benefit China and North Korea.

GSOMIA has allowed Tokyo and Seoul to share sensitive military secrets, including those concerning Pyongyang’s ballistic missiles and nuclear development programs.

The pact has streamlined communications between the three countries. The U.S. has a similar pact with each of Tokyo and Seoul..

“If South Korea scraps (GSOMIA), it could send a wrong message to North Korea and other countries in the surrounding area,” Defense Minister Taro Kono told a news conference on Friday before Seoul’s surprise announcement.

The recent Japan-South Korea dispute started late last year when South Korea’s Supreme Court ordered Japanese firms to pay compensation for wartime forced labor despite a 1965 pact that was concluded to settle all post-colonial compensation issues, including those for wartime labor.

Tokyo has demanded Seoul take measures to avoid damage to Japanese firms. Japan introduced the new export control measures in July, which have been widely regarded as a response to Seoul’s inaction on the wartime labor issue, despite Tokyo’s denials.

The Blue House had apparently believed that Washington would urge Japan to make concessions to improve ties with Seoul if it made the decision to withdraw from GSOMIA. But the U.S. instead started pressuring Seoul to renew GSOMIA, said Yuki Asaba, professor of Korean studies at Doshisha University in Kyoto.

After facing pressure from the U.S., the Blue House rushed to improve relations with Japan and tried to persuade it to pull back its export controls in exchange for Seoul’s renewal of the pact. Tokyo, however, has consistently argued the two are separate issues and Seoul must first address the wartime labor issues if it ever wants to improve bilateral ties.