North Korea’s nuclear test this week set off alarm bells in Japan and South Korea, but its more enduring outcome may be the cementing of a fragile reconciliation that could lead to military cooperation between the two key U.S. allies.

Japan and South Korea reached a landmark agreement last month to resolve the issue of “comfort women” forced to work in Japan’s wartime military brothels, which had been an emotive impediment to better ties. Japan apologized and promised about ¥1 billion ($8.47 million) to help surviving women who were coerced into prostitution.

North Korea’s latest nuclear detonation could strengthen that reconciliation, say military officials and defense experts, as the two countries unite against a common threat. That, in turn, could lead to military cooperation instead of the frosty distance they have maintained, even though they are Washington’s closest allies in the region.

“I think the comfort women pact and the North Korean test could spur military cooperation,” a senior Maritime Self-Defense Force officer said, speaking on condition he was not identified. “The test has worsened the security situation in the region.”

South Korean President Park Geun-hye spoke by phone to Prime Minister Shinzo Abe on Thursday. They discussed the need for close cooperation with each other, as well as with the United States, China and Russia, according to Park’s office.

Senior defense officials from South Korea, Japan and the United States held a video conference Thursday and agreed “to continue to cooperate closely and share information on North Korea’s nuclear threat,” Pentagon spokesman Jeff Davis said.

U.S. Secretary of Defense Ash Carter also spoke by phone to Defense Minister Gen Nakatani on Friday and “agreed that trilateral cooperation with the Republic of Korea is critical to deterrence and maintaining peace and security in Northeast Asia and beyond.”

The Pentagon said the two reiterated their commitment to continuing close trilateral cooperation and information sharing.

“There may be a broad review of what can be done to improve security cooperation (with Japan),” said a senior South Korean official, who asked not to be identified. Nothing specific has yet been discussed, he said.

The distance between South Korea and Japan has worried Washington as it increasingly relies on its Asian allies to work together to guarantee security in the region amid China’s growing military might.

Past strains have prevented Japan and South Korea from agreeing to share sensitive military information. An attempt to institutionalize security cooperation through the General Security of Military Information Agreement (GSOMIA) in 2012 failed after significant domestic opposition in South Korea.

In a bid to resolve the impasse, Washington agreed last year to act as a go-between to allow Seoul and Tokyo to swap intelligence.

“It really is in the interest of all three countries that we have no seams between that information when you are trying to defend your country against a ballistic missile,” Vice Adm. Joseph Aucoin, commander of the U.S. Seventh Fleet, said Friday.

When asked whether there was hope for greater cooperation between Japan and South Korea in the wake of the latest nuclear test, Aucoin replied “I got to believe so.”

In December 2014, Seoul said it would send the Lockheed Martin F-35 fleet it has ordered to Australia for maintenance, well beyond their operating range, rather than to a regional maintenance hub for the stealth fighter to be set up in Japan.

“Korea and Japan are in a complicated conflict because of the issue over comfort women, but we’re now in a new situation that shows how the two countries need each other,” Choi Kang, vice president and director at the Seoul-based Asan Institute for Policy Studies, said in a comment published by the institute.

Abe and Park, nonetheless, will still have tread carefully around long-held grievances that date back to World War II.

Seoul has criticized Japanese school textbooks that it says distort history and downplay Japan’s wartime and colonial atrocities and the two countries are at odds over territorial issues.

The comfort women issue remains contentious, despite the recent agreement.

“North Korea’s nuclear testing will help restore Japan-South Korean military cooperation. However, the comfort women issue will continue to haunt Park’s efforts to restore ties,” said Chung-In Moon, professor of Political Science at Yonsei University in South Korea.