Chinese President Xi Jinping is seen during a working session at the G20 leaders summit in Hamburg, Germany July 8, 2017. REUTERS/Wolfgang Rattay

BEIJING (Reuters) - Chinese President Xi Jinping urged Japanese Prime Minister Shinzo Abe on Saturday to put aside “distractions” that have strained bilateral ties and warned that China was unwilling to compromise on Taiwan, state news agency Xinhua said.

Relations have been complicated for decades by the legacy of Japan’s wartime aggression.

Self-ruled Taiwan, which is claimed by China and was governed by Japan from 1895-1945, is another sensitive issue, and a maritime territorial dispute over small islands in the East China Sea has deepened mutual suspicion in recent years.

Beijing complained to Tokyo in March after a Japanese minister visited Taiwan, and China has also told Japan not to get involved in the dispute over the South China Sea.

Meeting on the sidelines of the G20 summit in the German city of Hamburg, Xi told Abe the countries were important neighbors, and said the healthy development of relations was of importance to the rest of the world, Xinhua said.

Xi urged Japan to learn from history so as to have a “better future” in its ties with China, the report added.

“Noting that the China-Japan ties have been distracted by complicated factors despite some positive exchanges between the two sides, the Chinese leader said there is no room for compromise on the issues related to history and Taiwan, and Japan shall honor its words in these respects,” Xinhua said.

Adding to long-standing tensions, China said last month a Japanese citizen was being investigated for harming national security, following a similar case in May in which China said six Japanese were being questioned on suspicion of illegal activity.