A Japanese diplomat in Beijing was detained temporarily earlier this week while on duty, with China arguing Wednesday that its action was justified because the official was engaging in inappropriate activity.

Japanese Foreign Minister Yoshimasa Hayashi told reporters Tuesday night that the government had lodged a protest with China through diplomatic channels, saying, "We cannot overlook (the incident) and will never accept it."

But the Chinese Foreign Ministry balked at the protest on Wednesday, saying that the unidentified diplomat at the Japanese Embassy in Beijing had been investigated and questioned in accordance with the law after acting inappropriately, without elaborating.

"China has lodged solemn representations with Japan, urging it to strictly restrain the words and deeds of diplomatic personnel in China" and "prevent similar incidents from happening again," Foreign Ministry spokeswoman Hua Chunying told reporters in Beijing.

Chinese Foreign Ministry spokeswoman Hua Chunying attends a press conference in Beijing on Feb. 23, 2022. (Kyodo) ==Kyodo

A Chinese official told Kyodo News that the diplomat was collecting information illegally.

A statement released by the Chinese Embassy in Tokyo also said earlier Wednesday that Japan should respect China's laws and manage the behavior of its diplomats.

The statement came after Japanese Vice Foreign Minister Takeo Mori summoned Yang Yu, charge d'affaires ad interim of the Chinese Embassy in Tokyo, to the ministry on Tuesday.

Mori demanded that China issue an apology and prevent a recurrence saying the incident clearly violated the Vienna Convention on Diplomatic Relations, the ministry said.

Yang, meanwhile, told Mori that he would report to his government, according to ministry officials.

Japanese Ambassador to China Hideo Tarumi also made a similar request to China's Assistant Foreign Minister Wu Jianghao.

The Japanese Foreign Ministry said the diplomat was detained Monday afternoon while on legitimate official business. A few hours later, the diplomat was released after exchanges with Chinese authorities and was not physically harmed.

The Vienna Convention on Diplomatic Relations requires the hosting state to prevent any disturbance of the peace of a diplomatic mission or impairment of its dignity.

Hua, however, said the convention "clearly stipulates the behavioral boundaries of diplomats," adding, "Diplomats are obliged to respect the laws and regulations of the hosting country."