China on Thursday defended its stance on the Ukraine conflict as being “on the right side of history”, after a US warning that Beijing’s unwillingness to sanction Russia could affect its relations with other economies.

Beijing has refused to condemn Moscow’s invasion of Ukraine, treading a diplomatic tightrope between backing its close ally and maintaining ties with the West by avoiding outright violations of sanctions placed on Russia.

That has put China at odds with the United States and its allies, which have responded with fury to the seven-week-old conflict, sanctioning Russia’s financial system and other parts of its economy in an effort to get President Vladimir Putin to back down.

Chinese foreign ministry spokesman Zhao Lijian on Thursday insisted China’s stance was “objective and impartial”, saying “Russia’s legitimate security concerns should also be respected”.

Zhao’s comments came a day after US Treasury Secretary Janet Yellen warned that China could suffer economic consequences for not participating in Western sanctions against Russia.

Yellen called on China to “help end this war”, adding that the Asian giant could see a decline in “the world’s attitude towards China and its willingness to embrace further economic integration” if Beijing did not act soon.

Zhao slammed Yellen’s remarks as “groundless accusations and suspicions”.

“Time will prove that China’s position is on the right side of history,” Zhao said at a regular press conference.

Washington has raised fears that China could send military and economic aid to Russia or help it navigate the tough sanctions battering its economy.