AT FIRST blush, it looks like a beautiful marriage of ideological consistency and practical benefit. With its “principled” objection to the sanctions imposed by America and Europe because of Iran's assumed nuclear ambitions, China remains true to its long-held opposition to sanctions as a tool of foreign policy. More broadly, it can continue to harp on about its devotion to the principle of “non-interference” in other countries' affairs. Meanwhile, as Europe's ban on imports of Iranian oil takes effect, China, which accounts for over one-fifth of Iran's oil exports, can expect chunky discounts on the oil it continues to buy.

Small wonder then that Tim Geithner, America's treasury secretary, visiting Beijing this month to seek China's help in curbing Iranian oil exports, received a polite brush-off. “We oppose pressuring or international sanctions, because these pressures and sanctions are not helpful,” read a deputy foreign minister from page one of his diplomatic manual. A few days later China's hauteur turned to indignation when America announced sanctions on a Chinese company, Zhuhai Zhenrong, for its dealings with Iran, even though the sanctions were largely symbolic.

China's stance over Iran, however, is far from clear-cut. It finds itself in a pivotal but acutely uncomfortable position. The simplistic old platitudes in which its foreign policy is couched cannot do justice to the complexity of the calculations it has to make. Most of its foreign-policy principles, says Minxin Pei of Claremont McKenna College in California, are “either obsolete or under pressure”, and Iran is an example of their irrelevance.

They do seem nevertheless to provide intellectual cover for a self-interested policy. (That is the mark of what diplomats call “good principles”.) “Energy security” has long been a priority for Chinese diplomacy. It has underpinned its friendships with other regimes excoriated in the West: pre-division Sudan, for example, or Myanmar's junta before it donned civilian clothing and gave charm a chance. In Iran, China has longstanding commercial relationships and an important—and cheap—energy supplier. Naturally it wants to avoid antagonising a reliable old friend.

Moreover, China has more reasons than usual to be suspicious of America's intentions. Viewed from Beijing, the “pivot” towards Asia announced by Barack Obama in November, as he unveiled plans for American marines to establish a permanent presence in northern Australia, was an affront. It was taken as a message to the Asia-Pacific region that America now saw China's rapid economic and military advance as the main global strategic threat to its interests, and as a threat that it was determined to counter. That many of China's neighbours welcomed the pivot only made things worse,

It is in this context that the more nationalistic sections of the official Chinese press are fuming about American pressure on Iran. Global Times, a Beijing newspaper (“the Fox News of the Chinese media”, in Mr Pei's phrase), has argued that this pressure has led increasing numbers of people in both China and Russia to advocate an alliance between the two countries, directed at America. That seems far-fetched—after all, Russia is probably on better terms with both India and Vietnam, traditional Chinese rivals, than it is with China itself. But, at the very least, China would want to maintain a common anti-sanctions front with Russia on the United Nations Security Council—ensuring that the American and European embargoes are not supplemented by UN sanctions.

A final reason for resisting sanctions might be a genuine fear of their effect on Iran. If the Iranians were to carry out their threat to blockade the Strait of Hormuz, China would suffer directly, through a likely surge in the oil price. A blockade would also bring closer the prospect of a potentially disastrous conflict.

However, this calculation of Iran's possible actions could just as well be one of many reasons why China might eventually soften its objections to sanctions. If Iran is emboldened by the support it believes it has from China and others to resist Western pressure over its nuclear programme, then that, too, could lead to conflict. Israel, for instance, might take matters into its own hands, with a pre-emptive strike against Iranian nuclear facilities.

It is fair to assume that Chinese leaders are sincere when they say they do not want a nuclear-armed Iran. Wen Jiabao, China's prime minister, was unusually explicit about this on January 20th. China, he said, “adamantly opposes Iran developing and possessing nuclear weapons.” China may resent the hypocrisy of Western leaders, who tolerate nuclear programmes in India and Israel, but it seems to accept that Iran's acquisition of the bomb would be bad for regional stability.

Mr Wen was speaking in Qatar during a tour that took in the United Arab Emirates and Saudi Arabia—but not Iran. This carried a reminder to Iran that, big though its oil exports to China are, they come to only about half of Saudi Arabia's. Not only would China want to be sure it had other sources of supply if Iranian oil dries up. It would also be wary of antagonising Saudi Arabia, a strong supporter of the American and European embargoes. And in fact Chinese purchases of Iranian oil have fallen sharply in January, supposedly because of a commercial dispute.

Words speak louder than actions

So from EU and American perspectives, China's position on Iran has been neither as unhelpful nor as principled as feared. With the Communist Party's ten-yearly leadership transition looming in the autumn, its leaders' preoccupations lie at home. They do not want to find China caught in the middle of a huge international crisis. They have a genuine interest in maintaining peace, and will not endanger it through a misplaced sense of loyalty to Iran, nor with outworn diplomatic dogma.

Economist.com/blogs/banyan