TOKYO — Leaders have turned their backs on each other. They have traded barbs. Military and business ties are fraying, and the media is up in arms.

Relations between Japan and South Korea, the most important U.S. allies in the Asia-Pacific region, are unraveling fast. 

And while the leaders of both countries share the blame, the Trump administration has taken its eye off the ball, experts say. This has allowed spats to grow that could undermine U.S. efforts to sustain a coalition of Asian democracies and contain China.

Japan ruled over South Korea from the beginning of the 20th century until the end of World War II, and Seoul and Tokyo’s complicated history has always loomed large in the background.

But the rancor that has soured relations lately is among the worst in generations.

“The relationship between South Korea and Japan is suffering a compound fracture unprecedented in the five decades since the two countries established diplomatic relations,” said Shin Kak-soo, a former South Korean ambassador to Japan.

He added, “The Trump administration did not pay attention to the alliance.”

The rift came after a South Korean Supreme Court decision in October ordering a Japanese steel producer to compensate Korean workers forced into labor during Japanese colonial rule, but the root of the crisis runs much deeper and its effects have reverberated in all directions since.

In November, South Korea shut down a foundation established to help care for the Korean women — more commonly known as “comfort women” — who were forced into sexual slavery in Japanese military brothels during World War II. The foundation was funded by Japan as part of a 2015 deal intended to put the issue to rest.

Then Tokyo went public with accusations that a South Korean warship had locked its fire-control radar onto a Japanese patrol plane, a move seen as a precursor to actually firing. 

Seoul denied the accusation and countered with the charge that the Japanese plane had been flying dangerously low. 

Japan’s conservative Prime Minister Shinzo Abe and South Korea’s liberal President Moon Jae-in come from opposite ends of the ideological spectrum.

In South Korea, Abe is an unpopular figure, seen as reluctant to express genuine remorse for Japan’s behavior during its colonial rule over the peninsula. 

In Japan, Moon is seen as the latest in a long line of South Korean leaders who have exploited popular resentment of Japan to shore up their own flagging popularity and reneged on agreements reached by previous governments.

Tokyo says the Supreme Court decision violates a 1965 deal establishing diplomatic relations, under which Japan gave South Korea much-needed economic aid as compensation for forced labor. 

But if Japan takes a legalistic position, then many South Koreans are more concerned with what they see as justice, said Shin. Moon himself was a human rights lawyer who once represented claimants in a case against Mitsubishi over forced labor.

Liberals in South Korea tend to see the 1965 agreement as an unequal treaty imposed by Japan on a weak country still recovering from the ravages of war, led by military strongman Park Chung-hee, who trained in the Japanese puppet state in Manchuria during the final stages of World War II.

To outsiders, the antipathy between the two countries — both free market democracies with close relationships to the West — can come as a surprise. 

But the tragedy of the current crisis, according to Yasushi Kudo of the Japanese think tank Genron NPO, is that this antipathy had been gradually subsiding, especially among young people, thanks in part to booming tourism and a mutual affinity for the other country’s popular culture.

A territorial dispute over a group of small islands, administered by South Korea but claimed by Japan, has also inflamed passions, notably when then-President Lee Myung-bak visited the islands in 2012. 

But the relationship is also complicated by the immense changes that have swept through South Korea over the past five decades, as the country has emerged from Japan’s shadow to become a thriving democracy and economic powerhouse in its own right.

South Korea grew up, and Japan never really accepted that, according to Koichi Nakano, a political science professor at Tokyo’s Sophia University.

“Many Japanese leaders are still caught up with a condescending, or even perhaps bordering on a racist, attitude toward South Korea as a smaller and less developed country,” he said. “There is this attitude among conservatives that, at the end of the day, we can bully Korea into submission.”

South Korea, fiercely nationalistic in its own right, is far from overawed. In fact, it’s preoccupied with other issues — its relationships with North Korea, the United States and China are today seen as more important than its relationship with Japan. 

Liberals in Seoul tend to place less value than conservatives on the alliance with the United States, and so less value on the triangular relationship with Japan, said Junya Nishino, director of contemporary Korean studies at Keio University in Tokyo.

At home, though, both leaders are playing populist tunes, and the media in both countries is dancing to it. 

Nishino fears the situation is about to get worse. Despite tensions, the relationship was founded on strong ties between the two militaries, civil society contacts and extensive business and trade links.

All three have suffered in the latest dispute.

 Former U.S. president Barack Obama played an important role in mending ties between the two countries earlier in the decade, arranging a trilateral summit in 2014 and brokering the comfort women agreement the following year. By contrast, Trump has shown much less interest in or affinity for America’s Asian allies, experts in both countries said. 

The crisis is bad news for the United States, experts say, and undermines U.S. efforts to gather like-minded nations under the banner of a free and open Indo-Pacific and counter China’s rising influence.

However, it also undermines Japan’s “brand” in Asia, Nakano said, with its ability to play a leading role in the region hobbled by its failure to resolve disputes over its wartime past, especially with a fellow democracy.

“Japan can’t continue to have the influence it used to have in the region without getting along with Korea,” he said. “As a democracy, we were supposedly at the forefront of progress in Asia in the postwar period, but we are becoming more and more reactionary, a declining power.”

Akiko Kashiwagi in Tokyo and Min Joo Kim in Seoul contributed to this report.