China called on its people on Sunday to keep within the law in their "understandable" anger at Japan, a day after protesters in both countries rallied to claim sovereignty over disputed islands.
Relations between Asia's top economies worsened sharply last month, when Japan detained a Chinese fisherman whose boat collided with Japanese patrol ships near the disputed islands -- called Senkaku in Japan and Diaoyu in China.
The islands are near potentially huge oil and gas reserves in the East China Sea.
"It is understandable that some people expressed their outrage against the recent erroneous words and deeds on the Japanese side," foreign ministry spokesperson Ma Zhaoxu said in a statement posted on the ministry's website early on Sunday.
"We maintain that patriotism should be expressed rationally and in line with law. We don't agree with irrational actions that violate laws and regulations."
An estimated crowd of 2,000 gathered in downtown Chengdu, capital of China's southwestern Sichuan Province, from early afternoon on Saturday, unfurling banners and shouting "Defend the Diaoyu Islands", "Fight Japan" and other slogans.
In Tokyo on the same day, more than 2,000 protesters marched to the Chinese Embassy, waving flags and chanting in opposition to China's claim to the uninhabited islands.
China's foreign ministry expressed deep concern at the Tokyo demonstration, which it said comprised hundreds of right-wing activists, and urged Japan to ensure the safety of its embassy personnel.
Japan also urged China to secure the safety of Japanese nationals and to ensure that economic activities can take place normally after some Japanese-brand stores in Chengdu were damaged by protesters, Yomiuri newspaper reported.