A war veteran leads others clad in costumes of the Imperial Japanese Army during a visit to Yasukuni Shrine to pray for war victims in Tokyo on Aug. 15, 2012. (Toru Yamanaka/AFP/Getty Images)

At a Shinto shrine here lined with cherry trees, a war museum asserts a jarring and unrepentant storyline about Japan’s wartime past, brushing aside well-documented atrocities and describing its rampage through Asia as tragic but justified.

The museum, making its case with videos and wall displays, says Japan “advanced through” Asia between 1931 and 1945 to protect neighboring countries from Western colonialism. There is no mention that the Imperial Army forced women into front-line brothels, or that its soldiers ransacked cities, using civilians for bayonet practice.

The Yasukuni Shrine is a religious site, not a national one, and some Japanese visit simply to honor the war dead. But Yasukuni and its adjacent museum remain the symbolic heart of World War II militarism, when Shinto was the state-sponsored religion and an emperor-worshiping army tried to take control of Asia.

The shrine in central Tokyo also has come to symbolize a hardening, did-no-wrong narrative here about history, even though it contradicts the near-consensus of historians, including most in Japan. That sentiment was once held by only a nationalist fringe, but it is pushing closer to the mainstream as Japan’s political leaders shift to the right amid fears that the economically stagnant country is losing its clout.­­

Japan and the neighbors it once invaded — particularly South Korea and China — have long squabbled over past animosities, but most historians and security experts had predicted that those differences would dissipate, not intensify, as decades passed. The opposite is proving true.

As Tokyo’s relations with Seoul and Beijing deteriorated this summer over territorial disputes, Chinese and South Korean leaders used unresolved anger about Japan’s wartime brutality as a way to build domestic support. They have also demanded an unequivocal apology from Japan — something they say they have not been given — raising pressure on Japan to form a consensus about how to remember and reckon with its war memory.

Yasukuni has reemerged as the battleground for that debate. When Shinzo Abe, the front-runner to become prime minister after December elections, visited the shrine in October, South Korean and Chinese government spokesmen blasted the move, with a Chinese Foreign Ministry spokesman demanding that Japan “face up to and rethink history.”

But less attention was paid to reaction within Japan, where polls throughout the years suggest that most Japanese view World War II and its run-up as a dark point in the nation’s history, an example of military ambition run amok.

“Japanese people are way ahead of political leaders on this, and their common sense is strong,” said Jeff Kingston, author of “Contemporary Japan” and a professor at the Tokyo campus of Temple University. “They’ve so far resisted the siren’s song of patriotism their leaders try to stoke.”

When Yasukuni in 1978 enshrined 14 Class A war criminals — those tried and sentenced as leaders of the war — Japan’s emperor, in a tacit sign of disapproval, ceased his occasional trips to the site. And no prime minister has visited since 2006. But Abe, after his visit, refused to say what he would do if elected.

Among the criminals enshrined at Yasukuni is Iwane Matsui, commander of the troops that carried out the Nanjing Massacre, a six-week takeover of the Chinese historical capital in 1937 that resulted in the deaths of hundreds of thousands. (An international military tribunal puts the death toll at 260,000. China officially puts the number at 300,000.)

At the shrine’s museum, only two paragraphs are devoted to what happened in Nanjing, and neither describes a massacre. The museum explains in English and Japanese only how the Japanese Imperial Army occupied the city to discourage “the Chinese from continuing their resistance.” It also explains that Matsui gave his soldiers strict orders to maintain discipline.

But there is no mention that those orders were categorically ignored and that Japanese soldiers raped children and the elderly, buried captives to their waists and had them torn apart by dogs, and were photographed laughing while beheading victims. There also is no mention that Matsui — as described in Iris Chang’s comprehensive book, “The Rape of Nanking” — lamented the runaway violence after learning what his troops had done.

Debate over sex servants

Japan has struggled to make amends with its neighbors in part because it needed to wait so long to try, cut off for decades from China because of the Cold War. Japanese historians also emphasize that Beijing and Seoul have their own national narratives and that their governments sometimes benefit from maintaining grudges against Tokyo. China and South Korea, some experts here say, should recognize the contrition in Japan’s actions — in its constitutional rebuke of war and its transformation to a pacifist nation.

“We have to reflect on our invasion and the war,” said Shin Kawashima, a University of Tokyo professor. “But Chinese should also reflect on the Japanese changes after that war era.”

But mostly, Japan’s struggle to apologize is rooted in a domestic disagreement over what it should say. Tokyo has indeed issued several high-profile apologies, most notably with the 1993 Kono statement and the 1995 Murayama statement, made on the 50th anniversary of Japan’s surrender, but both have sparked outrage from nationalists, muddling the message.

Recently, some of the most inflammatory comments have come from the mainstream — particularly on the topic of sex slaves used by the Imperial Army. The Yomiuri Shimbun, Japan’s largest newspaper, wrote in an August editorial that there is “no evidence” that Japan had forcibly recruited sex slaves, known euphemistically as comfort women. But that viewpoint goes against those of foreign governments, including the United States, where the House of Representatives in 2007 called on Japan to apologize for “officially commissioned” front-line sex servants in “one of the largest cases of human trafficking in the 20th century.”

The national debate about history also plays out in textbooks. A plan from the Liberal Democratic Party, the presumed ruling party after the next election, would overhaul the government screening process for textbooks because, party officials say, the current ones are too self-deprecating to Japan.

Some historians worry that Japan is handing off its history to revisionists — “professors in literature, cartoonists, novelists and politicians,” said Shinichi Kitaoka, who led a government-funded history research project with China. “But it’s clear — Japan made the aggression. We are responsible. There were many, many illegal killings . . . This view is shared by 99 percent of historians in Japan. The others, they are mostly amateurs.”

‘Beautiful and silent’ shrine

Yasukuni has turned into such a provocative symbol, it overshadows the feelings of those who actually go there. Kazuhiro Haraguchi, a member of the Democratic Party of Japan in the recently dissolved Diet, was among the dozens of parliamentarians who visited Yasukuni in October.

He says that he isn’t proud of Japan’s ongoing debate about its war memory and that he regrets the enshrinement of war criminals. But he also notes a “severe misunderstanding” about the shrine itself. It’s a peaceful place, he says — “beautiful and silent” — and many who go there feel contrite.

The goal of enshrinement, Haraguchi said, is not to praise the soldiers, but to purify them, wiping away their evil deeds. Those who visit the shrine, he said, should reflect on what Japan has done in the past, “so we do not repeat that era of violence.”

“We have not been able to find any answer why we couldn’t stop fascism back then,” Haraguchi said. “Why can’t we look clearly at our past?”

Yuki Oda contributed to this report.