In a major policy reversal, South Korea said Friday it has decided to continue a 2016 military intelligence-sharing agreement with Japan that it previously said it would terminate amid ongoing tensions over wartime history and trade.

The announcement, made just six hours before the agreement was to expire, followed a strong U.S. push to save the pact, which has been a major symbol of the countries’ three-way security cooperation in the face of North Korea’s nuclear threat and China’s growing influence.

The office of South Korean President Moon Jae-in said it decided to suspend the effect of the three months’ notice it gave in August to terminate the agreement after Tokyo agreed to reciprocal measures.

South Korean Foreign Minister Kang Kyung-wha leaves the Foreign Ministry in Seoul, South Korea, Friday, Nov. 22, 2019. (AP PhotoLee Jin-man)

South Korean Foreign Minister Kang Kyung-wha leaves the Foreign Ministry in Seoul, South Korea, Friday, Nov. 22, 2019. (AP PhotoLee Jin-man)

But Kim You-geun, deputy director of South Korea’s presidential national security office, said the move was based on the premise that it could end the arrangement at any time depending on how relations with Tokyo proceed.

Kim also said South Korea decided to halt a complaint it filed with the World Trade Organization over Japan’s tightened controls on exports of key chemicals that South Korean companies use to make computer chips and displays.

The Japanese government said it has agreed to resume discussions with South Korea on resolving their dispute over the export controls.

South Koreans hold banners during a rally to demand to keep the General Security of Military Intelligence Agreement, or GSOMIA, near the Foreign Ministry in Seoul, South Korea, Friday, Nov. 22, 2019. South Korea says it has decided to continue a 2016 military intelligence-sharing agreement with Japan it previously decided to terminate amid ongoing disputes over their wartime history and trade. (AP PhotoLee Jin-man)

South Koreans hold banners during a rally to demand to keep the General Security of Military Intelligence Agreement, or GSOMIA, near the Foreign Ministry in Seoul, South Korea, Friday, Nov. 22, 2019. South Korea says it has decided to continue a 2016 military intelligence-sharing agreement with Japan it previously decided to terminate amid ongoing disputes over their wartime history and trade. (AP PhotoLee Jin-man)

The military agreement, which Japan had sought to maintain, is automatically extended every year unless either country notifies the other 90 days in advance of its intention to terminate it, a deadline that fell in August.

Washington had no immediate reaction to Seoul’s announcement.

Most South Korean analysts had anticipated that the Moon government would let the agreement expire, saying there was no clear way for Seoul to renew it without losing face.

A man walks near a banner demanding to keep to the General Security of Military Intelligence Agreement, or GSOMIA, in Seoul, South Korea, Friday, Nov. 22, 2019. South Korea says it has decided to continue a 2016 military intelligence-sharing agreement with Japan it previously decided to terminate amid ongoing disputes over their wartime history and trade. (AP PhotoLee Jin-man)

A man walks near a banner demanding to keep to the General Security of Military Intelligence Agreement, or GSOMIA, in Seoul, South Korea, Friday, Nov. 22, 2019. South Korea says it has decided to continue a 2016 military intelligence-sharing agreement with Japan it previously decided to terminate amid ongoing disputes over their wartime history and trade. (AP PhotoLee Jin-man)

Some saw the Trump administration’s public demands for South Korea to reverse the key diplomatic decision as a profound lack of respect for an ally.

The squabble over the Seoul-Tokyo pact came at a delicate time for the alliance between the United States and South Korea. The two countries have struggled to deal with North Korea’s nuclear threat while squabbling over defense costs.

In a rare public display of discord between the allies, U.S. negotiators on Wednesday cut short a Seoul meeting with South Korean officials over disagreements on how much South Korea should increase its contribution to covering the costs of maintaining the American military presence on its soil. South Korean officials say the administration of President Donald Trump has been demanding a “drastic” increase that they find unacceptable.

There’s also concern that Trump, after already suspending major U.S.-South Korean military exercises he described as “ridiculous and expensive,” may seek to reduce the U.S. military presence in South Korea to accommodate a deal with North Korean leader Kim Jong Un.

South Korea’s August declaration that it would terminate the General Security of Military Intelligence Agreement, or GSOMIA, with Japan came shortly after Tokyo removed its neighbor from a “white list” of countries receiving preferential treatment in trade.

South Korea saw Tokyo’s move, which followed strengthened controls on technology exports to South Korean chip and display manufacturers, as retaliation over political disputes stemming from Japan’s use of Koreans for forced labor before the end of World War II.

But following unusually blunt criticism from Washington, which said Seoul’s decision could hurt the security of its Asian allies and increase risks to U.S. troops stationed there, South Korea said it could continue the military agreement if Japan restores its status as a favored trade partner.

It seemed neither country was ready to budge from their positions after last-minute meetings between their diplomats and military officials over the past week ended without any apparent breakthrough.

Visiting Seoul last week, U.S. Defense Secretary Mark Esper said the agreement allows fast and effective information exchanges between the three countries which would be crucial in times of war. He said friction between the two U.S. allies would only benefit North Korea and China.

It took years for the United States to persuade South Korea and Japan to sign the GSOMIA, which was designed to facilitate direct intelligence-sharing between the Asian U.S. allies.

The agreement, which complemented a three-way 2014 deal that allowed Seoul and Tokyo to pass information on North Korea’s nuclear weapons and missiles via Washington, was seen as a major symbol of cooperation in coping with the growing North Korean threat and balancing China’s growing influence.

The GSOMIA made it easier for South Korea to access information gathered by Japan’s intelligence satellites, radar, patrol planes and other high-tech systems, which are critical for analyzing North Korean missile tests and submarines.

For Japan, the agreement with South Korea had value because its military sensors are positioned to detect North Korean launches sooner, and also because of information the country gathers from spies, North Korean defectors and other human sources.