This history is usually a story of power—primarily military/coercive and economic (sometimes also coercive)—and, according to the Realist school of international relations, that’s all there is. Notions of morality and ideologies, central to the Idealist school of understanding how countries actually behave, don’t count for much (however much one might aspire to morality in international affairs).
Of course, from a historical perspective, the nature of those ideas and ideals has changed over time: you can’t understand European politics from the 12C through the 19C without looking at the internal structures and changing configurations of Christianity during that era. Ditto the variations of Islam across North Africa through Central Asia from the time of Muhammad. For us in the 21C, the ideological sprawl of modernity is everywhere: Communism, Fascism, Liberalism, Nationalism, democracy, etc. For example, the conceptualization of the individual and ideas of international cooperation spawned in the 19C have played a global role, not least in the concept of human rights.
When combined with mass media and “public opinion,” there is motivational power—a “soft” power—in these ideas; at least to such a degree that virtually all countries pay at least lip service to the ideas of democracy and law and (dare I say it) morality. Yes, there are many variations and exceptions, and such “soft power” won’t win a war on its own, but what passes for global public opinion has had some alignment and securing its approbation is attractive even to the most craven (although this gets pretty faint at the extreme end).
As with other forms of power, this public esteem/consideration/acquiescence can be spent. It’s usually not as dramatic as a ship being blown up, or an IMF deal being reneged upon, but over time the reputation of states that gives them credence can also fade.
Probably the clearest example of this phenomenon lately is Israel. Here is a country that was established at the behest of European/Western countries in the aftermath of WWII in recognition of the horrific crimes committed against the Jewish people in the Holocaust. Tainted, to be sure, from the beginning, by the impact of its establishment on other peoples who had also been living on the same land; Israel’s alignment with Western democracies and its material success, its embrace of Jews leaving less friendly places around the world, has garnered wide respect, as well as accommodation for the actions it has taken vis-à-vis other groups in the Middle East. Notwithstanding the history that it stands on, Israel’s more recent pattern of aggressive behavior and settler imperialism has done much to erase its accrued goodwill. The latest excesses in Gaza have created a moral deficit that will take decades to offset.
A second example is South Africa, which gained substantial moral credit from its decades-long struggle for majority rule and democracy (now marking its 30th anniversary), embodied in the person and leadership of Nelson Mandela. It’s leadership since then has been spotty and prone to several varieties of corruption that often plague countries without deep practice in national community and civil society. Despite its regional (economic) influence and the lack of competitors in Africa for leadership, it risks leaving Mandela to history and becoming rather ordinary.
In the 20C, the Soviet Union initially garnered great credit for its (nominal) commitment to socialism and its success in modernizing its country (the costs and oppressions were helpfully hidden). It spent its moral capital crushing Poland, Hungary, and Czechoslovakia and had few friends when its economic contradictions finally undermined its political culture and its empire.
Finally, our own United States, which has claimed a mantle of democracy for over two centuries and whose commitment to global improvement over the 20C, most particularly during the two world wars, but also noted for its attention to democracy and human rights outside of wartime, is also facing a reckoning. To be sure, our efforts towards the world have always been colored by the promotion of our own interests and a string of excesses in the projection of power. For all those shortcomings, the US has likely done more good for others (both individuals and groups) than any other modern country. Still, memories are short (and getting shorter) and there’s no small sense of “what have you done for me lately? in the perception of 21C America in the world.
It is natural that both the power structures and the wider population within these countries (and there are others) have drunk deeply of the stories and characterizations that reflect this moral high ground. It becomes part of the national psyche, but that only makes the erosion more easily seen from the outside. It comes as a great shock to learn that one is not universally loved/respected. But the conflicts, compromises, and shortcomings inherent in the exercise of power (of all flavors) are more visible externally and the harms they cause are appropriately counted against whatever moral “assets” have been accumulated.
Countries that claim the “moral high ground” in terms of international stature, competition, and conflict seek to reap both tangible and “soft” benefits by holding themselves out as role models. They often seek to redefine morality so that their actions and beliefs place them on that “high ground” as well. Some countries, on the other hand, don’t care. But those that trade in this “moral economy” need to remember that even the loftiest and most robust enterprises can go bankrupt if they don’t watch their balance sheet.