SEOUL — South Korea’s leader warned Wednesday of an “unprecedented emergency” in relations with Japan, as a spat between the U.S. allies over historical grievances threatens to boil over into a full-blown economic confrontation and damage the global electronics industry.

The dispute stems from a Seoul court ruling last year ordering Japanese companies to pay compensation for their use of forced labor during Japan’s colonial rule of the Korean Peninsula from 1910 to 1945. Japan maintains that the compensation for forced labor was fully settled in a 1965 pact that restored diplomatic ties, though elderly former conscripts had pursued their own separate claims.

Angered by the recent ruling, Japan last week imposed restrictions on South Korea-bound exports of materials that South Korean firms use to make smartphone chips and other tech products — among the country’s main export items, including some that are used in Apple devices. Japanese officials also accused Seoul of flouting international sanctions that restrict trade with North Korea.

“With regards to the wartime-laborers issues, it has become clear that South Korea does not abide by international commitments. It is natural to assume that it also fails to keep promises on export control,” Prime Minister Shinzo Abe told a talk show on Sunday.

Frequent disagreements between the East Asian neighbors have long been a source of frustration in Washington. The United States counts both nations as crucial allies and relies on their cooperation to counter China’s growing military ambitions and North Korea’s weapons program.

With tensions mounting, South Korean President Moon Jae-in on Wednesday told executives from companies including Samsung and Hyundai to prepare for a prolonged fight. Pleading for a diplomatic solution, he said Japan’s export curbs were “politically motivated” and designed to hurt his nation’s economy.

Moon called on Abe to urgently withdraw the trade measures, saying the situation was unprecedented and that Japan was walking into a “dead-end street.”

“Since the measures will negatively impact the global economy, we will also seek international cooperation,” he added.

The State Department said Wednesday that it was critical that the United States, Japan and South Korea work together.

Though the Japanese restrictions don’t amount to an export ban, they require exporters to obtain a separate license each time they wish to ship materials to South Korea — creating long holdups.

“If the supply of Japanese parts or materials is interrupted, subsequently disrupting production at South Korean chipmakers such as Samsung Electronics, it could create turmoil across the world,” the Nikkei Asian Review magazine said in a recent editorial that warned of damage to firms such as Apple and China’s Huawei.

Shin Kak-soo, former South Korean ambassador to Japan, said the dispute could jeopardize joint efforts on the North Korean nuclear issue, and there was room for the United States to mediate between its two allies.

“However, the daylight between Seoul and Tokyo could weaken the coalition, as North Korea turns to China and Russia for a trilateral cooperation,” he said.

Many South Koreans say Japan hasn’t adequately atoned for abuses carried out during its colonial occupation of the peninsula. Tokyo contends that the 1965 treaty was supposed to draw a line under historical grievances.