While the North Korean threat loomed large, a meeting between the prime ministers of Japan and Australia in Tokyo yesterday bore the undercurrents of China's growing sphere of influence and doubts over the United States' commitment in the region.

These factors, observers said, have pushed Tokyo and Canberra closer together militarily as they seek to ensure a "free, open, stable and prosperous Indo-Pacific region" based on a "rules-based order".

The two nations, described as "special strategic partners" or "quasi-allies", yesterday vowed the early fruition of a pivotal security pact that will enable their troops to train on each other's soil.

They also pledged to urge the other nine nations in a mega Asia-Pacific trade pact - which replaces the Trans-Pacific Partnership (TPP) scuttled by the US' withdrawal - to ink the deal by March as planned. Singapore is among the countries involved in the Comprehensive and Progressive Agreement for TPP (CPTPP).

During his one-day trip, Australian Prime Minister Malcolm Turnbull visited a military training base outside Tokyo, viewed a Patriot Advanced Capability-3 missile interceptor and climbed on board an Australia-made armoured vehicle used in Japan. He also sat in on a National Security Council meeting with his Japanese counterpart Shinzo Abe.

Both leaders cautioned against being overly optimistic that the two Koreas are now back on talking terms to secure North Korea's participation at the Pyeongchang Games next month.

"History tells us a very bitter lesson about North Korea," said Mr Turnbull. "They have a long habit of ratcheting up their militarisation and then going into a lull for a while, while trying to persuade people that they're changing their ways, (and then) changing nothing and ratcheting up again."

Mr Abe stressed the need to ensure the strict enforcement of economic sanctions so as to tighten the noose on the North.

In a joint statement, the two leaders also expressed their concern about the situation in the South and East China Seas. On the latter, they "expressed strong opposition to any coercive or unilateral actions that could alter the status quo and increase tensions in the area".

Their meeting comes a week after Tokyo lodged a strong protest over Beijing's unprecedented dispatch of a nuclear submarine into waters near a disputed set of islets in the East China Sea known as Senkaku in Japan and Diaoyu in China. Beijing, in turn, said it disregards Tokyo's representations as it considers the islets a part of Chinese territory. Canberra, meanwhile, has criticised China for constructing "useless buildings" in its pouring of aid into Pacific Island nations.

It is against this backdrop that Japan and Australia have vowed to work closer militarily, with their first joint exercise involving fighter jets to be held in Japan this year.

The so-called "visiting forces agreement" - the first of its kind for Japan - will allow short-term stays by the Australian military in Japan, and enable Japanese troops to train in Australia. It differs from its Status of Forces Agreement with the US, which allows US troops to be stationed across Japan.

Once the pact is inked, Australia will be Japan's second-closest military partner after the US.

On the trade front, the two leaders, as flag-bearers for the CPTPP, stressed their commitment to bringing the agreement into force as soon as possible. While ministers from the 11 countries have agreed on the "core elements" of the deal, there are question marks over Canada's willingness to ink the deal in its current form after it raised new demands to ensure the pact protects jobs. Mr Turnbull said: "Our strong preference is for all 11 countries to join the first wave but our focus is on bringing a new TPP into force as soon as possible with those who are ready to move."

In a commentary for current affairs website East Asia Forum, Dr Shiro Armstrong of the Australian National University noted the bearing of the US and China on the leaders' talks. "These are the superpowers that determine and underpin economic, political and national security for Australia and Japan in Asia."