America's top military official has reiterated his country's pledge to defend Japan against a North Korean missile attack.

Joseph Dunford, the chairman of the Joint Chiefs of Staff, said in Tokyo on Friday that an attack on Japan or the U.S. is "an attack on both of us."

North Korea has threatened to test-fire missiles that would fly over Japan and land in waters off the U.S. territory of Guam. The U.S. is treaty-bound to defend Japan from outside attacks.

Dunford and his Japanese counterpart Katsutoshi Kawano agreed to work together to strengthen missile defense systems.

Sirens wailed across nine prefectures in western Japan on Friday in a test of an emergency alert system. The flight path of the North Korean missile test would cross that part of the country.