China said on Thursday it acted “in accordance with the law” despite condemnation from Canada over the execution of four Canadian citizens.