The foreign ministers of Japan and China have agreed to work on a bilateral consular treaty to avoid diplomatic conflicts such as the row triggered by China's removal of five North Korean asylum seekers from a Japanese consulate last month, Japanese officials said.

The agreement, reached Wednesday, is seen as the de facto end to the row, which strained bilateral ties and embarrassed both countries through widespread media coverage of the incident.

During their talks, Foreign Minister Yoriko Kawaguchi expressed hope to her Chinese counterpart, Tang Jiaxuan, that the Chinese government will treat North Koreans who have fled their country for China in a humanitarian way based on international law.

The consular pact, the details of which have yet to be ironed out, is expected to prevent the kind of problem that arose when Chinese police entered the Japanese Consulate General in Shenyang, northeastern China, and seized five North Koreans who had dashed into the compound.