STILL on crutches after a cycling accident, and with less good news to report than he must have hoped when his speech to a university in Singapore was scheduled, John Kerry, America’s secretary of state, was this week a study in embattled optimism. Ministers from the 12 countries, including his own and Singapore, which are negotiating a much-vaunted trade agreement, the Trans-Pacific Partnership (TPP), had just failed to clinch an expected deal. And China was refusing even to discuss its controversial island-building in the South China Sea at a regional summit in the Malaysian capital, Kuala Lumpur. Mr Kerry’s speech was defiantly upbeat. But America’s prestige in the Asia-Pacific has been dented of late. On the 70th anniversary on August 15th of Japan’s surrender and the end of the second world war, the American-led order in place since then looks rather brittle.

America itself has turned the TPP into the gauge by which its leadership in the region is measured. Officials and politicians from President Barack Obama down have portrayed it as the most important aspect of America’s “pivot” or “rebalancing” to the Asia-Pacific, and of its determination to help set the rules there rather than let China write them. Mr Kerry spoke positively of the progress made at the TPP talks in Hawaii, conceding only that “there remain details to be hashed out.” Ministers at the talks claimed that the deal was “98%” done. But the devil is in those details, and in any complex negotiation, the last bit is the hardest.

What appear to be the main remaining bones of contention are varied and tricky. Canada, where an election has just been called for October, does not want to open up its market for dairy products—a priority for New Zealand, one of TPP’s originators a decade ago. Liberalising Japan’s agricultural market, notably for rice, remains acutely sensitive politically. Mexico objects to the amount of content from countries not in the TPP that Japan wants allowed into its exports of lorries. America protects its sugar producers. And it wants its pharmaceutical firms to enjoy 12 years of patent protection on new biologic drugs, which most of the other 11 countries find several years too long.

Yet hopes had been high that the Hawaii talks might bring this marathon negotiation to the finishing line. They were the first between ministers since the American Congress narrowly voted to give the president “fast-track” Trade Promotion Authority (TPA), meaning that Congress could no longer unpick a trade agreement clause by clause, having to approve or reject it as a whole. Without TPA, other countries had been unwilling to make their best offers. Now, however, some speculate that, in the intense haggling to secure passage of TPA through Congress, the administration made promises that have hamstrung its negotiators. Another reason for believing the Hawaii round might be crucial was the pressure of the American political calendar. The administration has to give Congress at least 90 days’ notice before signing a trade agreement. So time is already running out if TPP is to be sealed before becoming embroiled in next year’s presidential election campaign. Even some of the most optimistic TPP supporters think a deal may now not happen until 2017 at the earliest.

After losing one battle in economic diplomacy to China by failing to persuade some close allies to reject China’s invitation to join a new Asian Infrastructure Investment Bank, America needs the TPP. Without an economic leg, other aspects of America’s rebalancing towards Asia, such as its military role, would become even more important. Many countries in the region are alarmed by what they see as an assertive, bullying China. They welcome America’s military might, and its willingness to project it across Asia. But China’s frenzied construction spree in the South China Sea presents America with a dilemma, even if, as China’s foreign minister said this week, the reclamation has now ended. America says it takes no position on the many overlapping territorial disputes there, the most active of which pit China against the Philippines and Vietnam; and it insists on asserting the “freedom of navigation” including of its navy and air force. Under the law of the sea, the artificial islands China has built on rocks and reefs that are submerged at high tide have no territorial waters.

Yet China is behaving as if they do—and so, perversely, is America. China insists the series of bilateral disputes in the South China Sea is none of America’s business and is not a topic for discussion at regional forums such as a 27-country one just hosted by the Association of South-East Asian Nations (ASEAN) in Kuala Lumpur. America, of course, disagrees, and has the backing of much of ASEAN for that. But it knows that if it does start testing Chinese resolve by sailing into or flying over China’s notional territorial waters, it could soon be seen as reckless and provocative, and find its regional support evaporate. So America’s inaction makes China’s new facts in the water look even more permanent and fosters the notion of relative American decline.

A TiP-ping point

That impression is heightened by the sense that America is less strident than it was in upholding its values of human rights, freedom and democracy. Cynics have always suspected that these ideals were subject to political exigencies. Last month they pointed to new evidence of this when the State Department promoted Malaysia from the bottom tier of countries listed in its annual Trafficking in Persons (TiP) report. It insisted this was because Malaysia was indeed cracking down on traffickers. Most Malaysians (and Thais, whose country was denied a similar upgrade) saw it as political: under American law a bottom-tier ranking would have meant that Malaysia would have to be excluded from TPP. The perception that TPP is so important to America to lead it to such distortions is damaging. It makes it look as if “the stable, transparent and rules-based” order Mr Kerry said America was promoting 70 years on from the war is one where America not only sets the rules, but twists them when they get in the way.