Justin Bieber blundered his way into one of the world's great geopolitical conflicts this week, paying tribute to some of Japan's most notorious World War II war criminals while visiting Tokyo.

According to the popstar's Twitter and Instagram accounts, he dropped in on the city's notorious Yasukuni Shrine, a religious site that has been a constant source of high-level diplomatic dispute between China and Japan. Former military leaders from Japan's imperial army -- including 14 class-A war criminals who orchestrated mass atrocities in China and other areas of Asia during the Pacific War -- are believed to have their souls enshrined there.

Apparently unaware of the history, Bieber tweeted "Thank you for your blessings," along with an Instagram photo of himself with his head devoutly bowed before the shrine's entrance.

The photo attracted some 666,000 likes on Instagram and tens of thousands of retweets before Bieber caught on to the controversial nature of place. The photo was soon deleted and replaced with a screen grab of Time magazine's coverage of his visit, and the following apology: "While in Japan I asked my driver to pull over for which I saw a beautiful shrine," wrote Bieber. "I was mislead to think the Shrines were only a place of prayer. To anyone I have offended I am extremely sorry. I love you China and I love you Japan."

Japanese leaders have continued to visit the Yasukuni Shrine as a show of national defiance and solidarity with the war dead. Each visit draws strong protests from China and Korea, which bore the brunt of Japan's wartime aggression. The issue remains highly sensitive among citizens of both countries.

And aside from the hundreds of the thousands of likes and retweets, the original photo attracted plenty of umbrage from Chinese and Korean fans.

"Maybe you are a giant in Japan and thats the reason why you like Japan. Anyway, please dont come to China forever, we really dont like stupid people," commented one Bieber follower.

"As a Chinese person, I can't stand Justin Bieber's visit," tweeted another on the Chinese social media service, Weibo. The post drew more than a thousand likes in less than an hour.

Another commentator using the name Viviyesgirl said: "After all, there are not too many Europeans and Americans who know the history between China and Japan. We should use this opportunity to let the world of 'Beliebers' know what the Yasukuni Shrine really means."

A user by the name Li Dan tweeted on Weibo: "He always does abnormal things. Now he can't expect that he will have any place in China."

The Chinese government's Foreign Ministry even managed to pile on during its daily briefing.

"I'm not aware of this situation and I don't know the political opinion of the so-called Canadian famous singer," said ministry spokesman Qin Gang at a briefing in Beijing on Wednesday, according to TheWall Street Journal. "But China's position on the Yasukuni Shrine is clear-cut. We are firmly opposed to the Japanese leaders' visit to the Yasukuni Shrine, where World War II second-class criminals are honored."

Shanghaist was one of the first to report on Bieber's controversial visit and posted the screen grab of his original Instagram post (above).