Justin Bieber has a habit of getting into trouble, but nothing may have quite prepared the Canadian pop star for the scale of the geopolitical situation he just got himself into in Japan.

The problem arose when the 20-year-old posted two photos to his Instagram page that appeared to show his visit to the Yasukuni Shrine in Tokyo. Both pictures have now been deleted, but not before they spread around the world. For example, the image above was posted to the Beijing-based That's Magazine. The reaction has been largely negative. "Say sorry to Chinese," one user writes in the screen grab above, while others swore at the pop star.

Bieber doesn't appear to know what the Yasukuni Shrine is – he says simply "thank you for your blessings" with the first picture, and in a follow-up post he explained he had been "mislead to think the Shrines were only a place of prayer." But to many of his 16 million Instagram followers in Asia, Yasukuni is perhaps one of the most offensive locations on earth.

Yasukuni is a shrine to the 2.5 million men, women and children who died serving the Japanese Empire between 1868 and 1945. Controversially, those honored include thousands of soldiers from World War II – and, as of 1978, 14 Class A war criminals.

For many in China, Korea and other Asian nations, Yasukuni represents the worst of Japan's imperial militarism. And yet, Japanese leaders have continued to visit it for years. Prime Minister Shinzo Abe visited the shrine last December despite protests from both China and South Korea, and sent an offering to it on Monday -- a controversial gesture just days before an official visit to Japan by President Obama.

Critics of Japan argue that the repeated visits to Yasukuni  show that the country has never truly deplored its aggressive behavior during the imperial period. Under Abe, the problem appears to have gotten worse: For example, Abe has disputed accounts of Japan's wartime use of Chinese, Korean and Southeast Asian sex slaves, angering many in those nations. It's a marked contrast from Japan's former ally, Germany, which has been at pains to distance itself from Nazi-era aggression and has prioritized reconciliation with its one-time foes. Chinese President Xi Jinping apparently hoped to point this out when he requested an official visit to Berlin's Holocaust Memorial during a recent trip to the city. (Germany, not wishing to become embroiled in an international incident, refused.)

Justin Bieber drew fire from South Korea and China after stepping into a bitter international dispute over Japan's wartime aggression. (Reuters)

World War II might seem a long time ago, but tensions still run high, especially in China, where a restaurant owner briefly became an online celebrity last year after putting a sign reading "Yasukuni Shrine" above his toilets. (In 2011, a Chinese man attempted to burn down the shrine using homemade explosives). The situation has become especially difficult recently due to a small group of islands in the East China Sea known as the Senkaku Islands by Japan and the Diaoyu Islands by China. These islands are administered by Japan but claimed by China and Taiwan. This is one of the most fraught geopolitical situations in the world right now -- some analysts have argued that the site could eventually become the spark that sets off World War III.

Bieber's impromptu trip to Yasukuni comes at a quite unfortunate time, too. The Senkaku/Diaoyu Islands, and all the historical baggage that comes with them, will likely be a key part of Obama's Asia trip -- a trip that begins today. Hopefully, the only damage done is to the pop star's Chinese record sales.

Correction: This post originally said that Abe visited Yasukuni on Monday. It has been amended to show that he in fact sent an offering, but did not visit.