Japan and South Korea formally signed an agreement Wednesday to share military intelligence on North Korea amid Pyongyang's ramped-up nuclear and missile programs and a swirling influence-peddling scandal threatening to oust South Korean President Park Geun-hye.

The contentious pact, known as the general security of military information agreement (GSOMIA), comes despite growing momentum that could see Park impeached. The final deal was also reached less than a month after talks resumed following a four-year suspension.

South Korean Defense Minister Han Min-koo and Japan's ambassador to the South, Yasumasa Nagamine, inked the agreement in Seoul, according to the South Korean Defense Ministry.