THE first visit by a Japanese prime minister in seven years to the Yasukuni shrine in Tokyo, made by Shinzo Abe on December 26th, looks like a diplomatic disaster. China, South Korea and America had all made clear their opposition to his going to a temple where the spirits of 14 high-ranking war criminals are enshrined, along with those of 2.5m other Japanese war dead. But Mr Abe had said he regretted not having visited the shrine during his first stint in the job in 2006-07. He may well have felt he had little to lose, and judge now that his decision to go has been vindicated by the international reaction.

The Chinese and South Korean governments were predictably fierce in their responses. A Chinese spokesman accused Mr Abe of “beautifying aggression”, and called the war criminals remembered at Yasukuni “the Nazis of Asia”. South Korea expressed “lamentation and rage”. The visit ruffled South-East Asia, too. Even Singapore, which rarely speaks out on such issues, expressed regret at Mr Abe’s visit.

America, too, was embarrassed and angered by the provocation. Senior officials of Japan’s closest ally had urged Mr Abe numerous times not to visit Yasukuni. He may have hoped that American annoyance would be tempered by the news on December 27th of progress in winning approval for the long-planned relocation of its Futenma air base on Okinawa to a less populous part of that island. Yet America, which kept silent during six visits to Yasukuni by a former prime minister, Junichiro Koizumi, from 2001 to 2006, this time expressed “disappointment”.

Its reprimand, however, was fairly gentle, urging Japan “and its neighbours” to work for better relations. And Mr Abe may even consider the threats from South Korea and China fairly toothless. South Korea’s president, Park Geun-hye, had already ruled out any meeting with Mr Abe. Her government’s poor relations with Japan are a concern for America, but not for Korean citizens or businesses.

As for China, its government has neither encouraged anti-Japanese protests nor imposed trade sanctions. Indeed, an editorial in the normally ultra-nationalistic Global Times newspaper argued for responding to Mr Abe’s provocation in a measured way, and shunning “large-scale economic sanctions”. China has ruled out any summit with Mr Abe. But tension over the disputed Senkaku or Diaoyu islands meant none was on the cards anyway.

So Mr Abe’s gamble looks, for now, to be fairly low-risk. His visit to Yasukuni clearly accords with his own desire to free Japan from what he sees as its humiliating, pacifist post-war constitution. Its timing was well calculated. In November China announced the establishment of an air-defence identification zone (ADIZ) in the East China Sea that overlaps with Japan’s own ADIZ and includes the disputed islands, which Japan controls. Mr Abe may have seen this act of Chinese assertiveness as cover for a nationalist step of his own.

He will also have been encouraged by a general warming towards Japan around the region. Since taking office a year ago he has visited all ten members of the Association of South-East Asian Nations (ASEAN) and in December he hosted a Japan-ASEAN summit. Even those ASEAN members seen as loyal friends of China, such as Cambodia, agreed to a statement on the importance of the freedom of aviation, an implicit—if mild—rebuke to China.

Concerns about China’s rise mean that many Asian nations, and even America, are prepared to put up with Mr Abe’s provocations, repellent though they find them. Ominously, one of his advisers says he might make a pilgrimage to the shrine an annual event. That Mr Abe appears to have got away with it this time is no guarantee he would keep doing so.