The national security advisers of Japan, the United States and South Korea agreed at a meeting in San Francisco over the weekend to work together closely in pursuing the denuclearization of North Korea, the Japanese government said Monday.

The trilateral talks Sunday brought Japanese national security adviser Shotaro Yachi together with U.S. counterpart H.R. McMaster and Chung Eui-yong of South Korea's National Security Office.

The three agreed not to repeat their "past failures" in halting the North's nuclear and missile programs and reaffirmed that they will "continue applying maximum pressure" on Pyongyang to give up the programs, the government said.

They also confirmed they will coordinate their policies in the run-up to the inter-Korea and U.S.-North Korean summits planned in the coming months, the government 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.