Story highlights Pact between Japan and South Korea comes amid rising North Korean threat

Two countries will share secret and confidential information

Seoul (CNN) Japan and South Korea, once bitter enemies, have agreed to their closest military cooperation since the end of World War II.

The deal, which has been in the pipeline for five years, will allow both countries to share military intelligence directly without using the US military as an intermediary.

Washington, a close ally of both countries, has long encouraged better relations between the two, even though many in South Korea are critical of the pact.

A spokesman for China's foreign ministry was critical of the deal, predicting it would increase "insecurity and instability in Northeast Asia."

South Korean protesters hold a rally Wednesday in Seoul against the signing of a military agreement with Japan.

Intelligence sharing