President Donald Trump on Friday called for improved relations between Japan and South Korea, saying heightened tensions between the two countries put the United States in a "bad position."

"South Korea and Japan are fighting all the time. They've got to get along because it puts us in a bad position," Trump told reporters at the White House. "They're supposed to be allies."

Trump made the remarks as ties between the key U.S. allies have sunk to the lowest level in years amid disputes over wartime history and trade policy.

Seoul has threatened to end a military intelligence-sharing pact with Tokyo, a move that would affect trilateral security cooperation with Washington in the face of security challenges posed by China, North Korea and Russia.

The General Security of Military Information Agreement, signed in November 2016, allows the two neighboring countries to share sensitive information regarding a nuclear-armed North Korea, which recently has conducted a series of short-range ballistic missile tests.

A deadline to decide whether to renew the agreement for another year comes on Aug. 24.

Asked if he is concerned about soured Tokyo-Seoul ties, Trump said, "I'm concerned that they're not getting along with each other."

"South Korea and Japan have to sit down and get along with each other," he said. "Otherwise, what are we all doing?"

On Wednesday, Marc Knapper, U.S. deputy assistant secretary of state for Korea and Japan, said Tokyo and Seoul can find space for "creative solutions," and that Washington stands ready to facilitate dialogue between them.

"We believe that prudence is required to prevent tensions from contaminating the economic and security aspects of Japan-South Korea ties," Knapper said as Beijing, Pyongyang and Moscow have apparently attempted to drive a further wedge in U.S.-Japan-South Korea security coordination.

"We believe that each bears responsibility for improving their relations," he told the Heritage Foundation, a Washington think tank. "Calm, confident words from national leaders, we believe, will generate a similar response from their nations."