Top national security advisers of Japan, the United States and South Korea agreed in their meeting in San Francisco to work closely together in seeking the denuclearization of North Korea, the Japanese government said Monday.

The trilateral talks on Sunday brought together Shotaro Yachi, Japan's national security adviser, his U.S. counterpart H.R. McMaster, and Chung Eui Yong, the head of South Korea's National Security Office.

Japan, US and S. Korea agreed not to repeat their countries' "past failures" in efforts to halt the North's nuclear and missile programs and reaffirmed that they will "continue applying maximum pressure" on Pyongyang to prod it to give up the programs, according to the Japanese government.

They also confirmed that they will coordinate their policies in the run-up to the inter-Korea and U.S.-North Korean summits planned in the coming months, it said.

Chung led a South Korean delegation to Pyongyang and held talks with North Korean leader Kim Jong Un earlier this month, during which the North's leader proposed the two summits.

Washington has long included itself in the Korean dispute. It has heavy military presence in the region and uses North Korea’s ballistic and nuclear programs as a pretext to constantly threaten Pyongyang with military action.

That military posture has concerned the North, which says it needs to advance its weapons program to protect itself against potential US military action.