China's president has sharply criticised Japan's history of military aggression in China and South Korea, during a speech in Seoul that came days after Tokyo changed its pacifist constitution.

"In the first half of the 20th century, Japanese militarists carried out barbarous wars of aggression against China and Korea, swallowing Korea and occupying half of the Chinese mainland," Xi Jinping said on Friday at Seoul National University.

China and the Korean peninsula were occupied by Japan in the early 20th century.

Xi's speech came on the second and last day of his state trip to South Korea, which had been flagged as a snub to ally North Korea because of his decision to visit Seoul before Pyongyang.

But the key issue of North Korea's nuclear weapons was mentioned in a passing reference to the need for a "denuclearised Korean peninsula".

Japan announced this week that its military had the right to go into battle in defence of allies, a major shift in the nation's pacifist constitution.

China, Japan, North Korea and its southern enemy are locked in a series of political and territorial disputes.

Relations between Seoul and Tokyo are at a low ebb, with governments mired in disputes related to Japan's 1910-45 rule over the peninsula. China is also embroiled in a territorial row with Japan over areas of the East China Sea.

Source: Al Jazeera and agencies