The comment alarmed many because it underscored an approach by Mr. Trump, like the rejection of migrants from certain predominantly Muslim countries, that has stripped much of the moral component from American foreign relations and left him being lectured by Chancellor Angela Merkel of Germany and others about his duties under international law.