In the past few years, the mainland leadership has spent masses of energy and hundreds of billions of yuan annually to build up its soft power and raise its profile on the global stage, befitting its rising economic prowess.
The major state media outlets appear to have fat budgets for expanding their reach to audiences in Asia, Africa, Latin America and even the United States. On Friday, the central government hosted the Fifth Confucius Institute Conference in Beijing, bringing together more than 1,000 representatives from about 500 Confucius Institutes worldwide in an effort to find more ways to promote Chinese culture and language.
Sparing no expense to showcase its achievements and present its friendly side to the rest of the world, the mainland has staged the spectacular Olympic Games in Beijing, the World Expo in Shanghai and the Asian Games in Guangzhou.
Just as those efforts helped China win friendship and admiration from foreigners, it then committed acts that were incomprehensible and outrageous - and felt across the world, as in the jailing of melamine-milk campaigner Zhao Lianhai and Nobel laureate Liu Xiaobo.
Mainland leaders may not have realised this as they fumed over the totally negative headlines in the overseas media: the international uproar over the way the two cases are being handled may risk cancelling out all the goodwill and admiration earned after spending so much energy and all those hundreds of billions of yuan.
Indeed, the recent developments have highlighted one of the great contradictions in China's way of dealing with foreign perceptions of itself. On the one hand, mainland leaders care deeply about what foreigners say about them and their policies, and secretly covet international praise. A small army of diplomats, journalists and national security agents sends a daily flood of cables to Zhongnanhai.
On the other hand, however, they are more than willing to go against prevailing international opinion by jailing a Zhao or Liu in the name of national security or stability. Then they react with paranoia to the international criticism by claiming to see ulterior motives in foreigners. This contraction hardly befits the mainland's status as a confident, rising power.
No one disputes the tremendous progress China has made over the past 30 years to build up the rule of law in the country. This partly explains why some senior officials were genuinely dismayed that Hongkongers across a wide spectrum, and the international media, took up the Zhao case in a big way, painting it as a condemnation of the whole country's judicial system.
Little do mainland officials know that overseas perceptions of the mainland's rule of law are formed less by the sheer number of laws formulated, and more by how the 'small cases' - handled by 'very local courts' like the one involving Zhao - are rendered.
It is ludicrous to jail Zhao, whose son was made ill by melamine-tainted infant formula, on the trumped-up charges of 'provoking quarrels and making trouble' after he sought to help other victims' families seek justice. It is even more incomprehensible that the authorities - backing down in response to a barrage of criticism in Hong Kong - apparently declined to allow Zhao to go through the legal process of appealing against the verdict and having it quashed.
Instead, they chose the approach of having Zhao fire his lawyers and ban his relatives from speaking to the media, and then granted him a medical parole. The fact that a Guangzhou-based, state-owned weekly last week risked official retribution and named Zhao the Grass-Roots Person of the Year for influencing the growth of China reflected the depth of feelings mainlanders have about this case.
Some mainland officials may have believed that granting parole to Zhao would placate people in Hong Kong. They little suspected that playing with the law like this would further diminish Hongkongers' confidence in the overall rule of law on the mainland.
In a similar vein, Beijing's reaction to Liu being awarded the Nobel Peace Prize on Friday was counterproductive. The mainland authorities were right to point out that the Nobel Committee's decision was political, but they should accept the fact that no matter how controversial or political the committee's selection proves to be, the award is recognised by most people in most countries.
It could have simply ignored the award to Liu, as it did in 2000 when Gao Xingjian , the Chinese-born novelist, received the Nobel Prize in Literature. Instead, it blocked access to foreign media outlets and intensified a crackdown on activists, which has certainly spurred more global attention to Liu's award. Even worse, such tactics will further widen the gap for foreigners trying to better understand China. All that energy and money has gone to waste.