Earlier this year, as Japanese Prime Minister Shinzo Abe was considering teaming up with arch-rival China to help deliver infrastructure projects under Beijing's US$1 trillion (S$1.37 trillion) Belt and Road Initiative (BRI), his ambassador to Indonesia was overseeing the finishing touches of an early study to construct a railway between Jakarta and the country's second-biggest city, Surabaya.
At stake was a rare chance to lock in Japanese standards for signalling and other rail technology as South-east Asia's biggest economy overhauls a rail system dating back to the Dutch colonial era.
Chinese contractors had beaten Japan three years ago to the US$5 billion high-speed railway between Indonesia's capital and its third-largest city Bandung, 150km away, but that project was stuck amid troubles acquiring land.
Although there has been no tender yet for the 800km Surabaya link, winning it would more than make up for the loss.
"That is how it goes," Japan's Ambassador to Indonesia Masafumi Ishii said. "Creating the system. Creating the standard. Getting there first. That is a very, very important aspect to competition. There is nothing to hide about that."
The comments reflect the intensifying contest between the two infrastructure behemoths - each hell-bent on setting standards, securing trade routes and locking in clients throughout the world's fastest-growing regions.
In October, Mr Abe proposed to his Chinese counterparts during his official visit to Beijing that the two countries team up on projects.
But after a year that saw China stumble badly from project cancellations and accusations of predatory lending, Japan may be more inclined to press home its advantage.
Japan's ultimate goal, analysts say, is to keep China in check, while threading rail, port and communications projects from South-east Asia to Africa that can boost economic growth and investment in Asia and Africa over the coming century - an initiative it calls the Free and Open Indo-Pacific (FOIP).
Japan's ultimate goal, analysts say, is to keep China in check, while threading rail, port and communications projects from South-east Asia to Africa that can boost economic growth and investment in Asia and Africa over the coming century.
"The prospect of Japan seriously contributing to the BRI remains distant," said professor of international relations James Brown at Tokyo's Temple University.
"China is perceived to be the main, long-term strategic threat to Japan, meaning that the BRI, along with other Chinese foreign policy initiatives, is viewed with suspicion in Tokyo."
He added: "The way in which the FOIP has been promoted also indicates that Japan has China's BRI in mind."
The BRI has had a particularly bad year. In Malaysia, the government of Tun Dr Mahathir Mohamad cancelled US$22 billion in rail and pipeline projects.
In Laos, the legions of Chinese workers that have followed the US$6 billion high-speed rail project linking Kunming in China with the capital Vientiane sparked local resentment and rumours that thousands of them were intent on staying.
In Sri Lanka, a lease-for-debt swop for Hambantota Port may have netted China a valuable asset on the periphery of its rival India, but the trade-off has raised suspicions that China is peddling in predatory loans to gain influence.
And in Indonesia, with around half of the land needed for track and stations on the Jakarta-Bandung railway still outstanding, work is already three years behind schedule.
The difficulties reflect the inexperience of Chinese officials working in Asian democracies, where consensus among local elites and the bureaucracy has to be painstakingly built up, analysts say.
Mr Rene Pattiradjawane, a researcher at the Centre for Chinese Studies in Jakarta, said that at the end of this year, Japan's infrastructure brand will be burnished while China's will be bruised. "The BRI is a wounded beast," he added.
Unveiled five years ago, the BRI, through China's state-owned engineering companies and its banks, has splashed out more than US$210 billion on ports and rail - mostly in Asia.
For now, though, Japan remains Asia's dominant infrastructure investor. Since 2000, Japanese infrastructure investment in Asia has added up to about US$230 billion, according to research published last year by BMI Research, which has since been bought by Fitch Solutions. Chinese investment accounts for about US$155 billion, it said.
Japanese staying power, in part, is linked to decades of engagement in the region and a meticulous approach to projects, said Mr Tom Lembong, chairman of the Indonesia Investment Coordinating Board, which oversees foreign direct investment.
"The Japanese like to break down projects into stages," he added.
Mr Lembong said Indonesia recently granted a 20-year tax holiday to Japan's Sumitomo and Kansai Electric Power, and Indonesian conglomerate Astra Group.
The companies make up a consortium that is building a 2000MW coal-fired power station in Central Java that will nearly double the joint venture's generating capacity at the site when it goes into operation in 2021.
Sumitomo insisted on the tax holiday to ensure the government was serious about the US$3.9 billion project, Mr Lembong said.
"These things are a statement of intent," he added. "They signal the government's strong commitment to the project."
Next year, the Mitsui-Sumitomo-led Japanese consortium building Jakarta's first MRT will wrap up work on the first stage of the system. While the MRT has been in the planning stages since the 1980s, work started on the US$1.2 billion project only after Japanese lenders secured government guarantees that the operating company would repay the debt.
But China's deep pockets and the sheer scale of demand for newer and more efficient ports, faster and safer trains, and more comprehensive public transport mean Japan is steadily losing ground to China.
The World Bank said last year that bringing Indonesia's infrastructure up to par with its emerging market peers such as Thailand would require US$1.5 billion. Annual foreign direct investment (FDI) from China into Asean member countries nearly doubled during the three years to 2017. Japan's FDI has been more or less steady during that time at about US$13 billion a year, according to Asean data.
For its part, Japan has earmarked just over US$200 billion for infrastructure though the Asian Development Bank and in development assistance though the Japan International Cooperation Agency.
As it secures trade links and clients between Asia and Africa, Japanese officials hope to manage their relative decline and insist that they wish China becomes more methodical in its planning.
"We would like to see China's initiative more quality-oriented. That's our wish," Mr Ishii said.