F OLLOWING A DISMAL winter you can’t count on a good summer, yet Tsai Ing-wen is making hay. Early in the year, Taiwan’s president had appeared mired in gloom. Ordinary Taiwanese were disillusioned with her stewardship of the economy. Her Democratic Progressive Party ( DPP ) had fared so badly in municipal elections that she felt compelled to step down as party leader. To compound it all, Xi Jinping, China’s ruler, had made it clear that China, which claims Taiwan as its own and which has ostracised Ms Tsai and her independence-leaning party, was in no mind to make life easier for her or for Taiwan.

What a difference a few months make. First, Ms Tsai emerged surprisingly strongly from a primary contest in which she beat off William Lai Ching-te, the former mayor of Tainan, who challenged her to be the DPP candidate to contest the next presidential election. The primary, curiously, is decided by taking opinion polls of voters. Some experts suspect Ms Tsai’s camp of massaging the outcome. But there is no doubt that Ms Tsai’s firm support for pro-democracy protests currently roiling Hong Kong (see article) boosted her standing at home. She has since welcomed several dozen Hong Kong protesters who reportedly intend to seek political asylum in Taiwan. By contrast, the protests have thrown the opposition Kuomintang ( KMT ), which is conciliatory towards China, off balance.

With a fair wind at her back, Ms Tsai breezed off to America on July 11th. Her two-day stay in New York, complete with a ferry ride near the Statue of Liberty, was intended to ooze normality, but visits by presidents of Taiwan are unusual and heavily circumscribed. The country has no formal diplomatic relations with America, along with the many other nations that acknowledge the “one-China principle” insisted upon in Beijing. Officially, Ms Tsai was en route to a handful of diplomatic allies in the Caribbean. But her stay was one of the longest that America has granted to a leader of the robustly democratic island.

China thundered in vain that America should cancel her visit, during which she met members of Congress and delivered a speech at Columbia University in defence of liberal, democratic values. “Taiwan is not, and will not be, intimidated,” she said at a reception in New York with representatives of Taiwan’s 17 remaining diplomatic allies. Her Caribbean visit was book-ended by a further two days in Colorado.

It all signals an unusual degree of approval by champions of democracy in Congress and by China hawks in Donald Trump’s administration. They have seen tensions with China rise over trade and cyber-security. Taiwan, too, faces increasing military and diplomatic pressure over Ms Tsai’s refusal to accept that her island is part of the Chinese motherland. A Chinese defence white paper this week repeated China’s threat of the use of force to prevent Taiwan’s independence. Yet Ms Tsai has been at pains not wantonly to rile China, unhinge relations across the Taiwan Strait and so risk dragging America into a dangerous conflict.

Marks of strengthening relations with Taiwan have mostly been small yet symbolic. On a previous transit in Houston, Ms Tsai visited NASA , becoming the first Taiwanese leader to set foot in an American federal agency since 1979, when America broke off diplomatic relations in favour of China. In May Mr Trump’s national security adviser, John Bolton, met his Taiwanese counterpart, David Lee, another first.

Senior members of Ms Tsai’s government joke that having no formal relations with America is an advantage, since Mr Trump, who sometimes seems to prefer autocracies to democracies and who seeks an elusive trade deal with China, is less likely to notice the thickening of ties. The president has signed off on a more tangible measure of assistance for Taiwan: approval for a long-planned sale of arms, worth $2.2bn, that includes tanks and Stinger anti-aircraft missiles. The sale of more than 60 F -16 fighter jets looks likely soon, too.

China claims to be outraged by the recent sales and has threatened to impose sanctions on the American companies involved. Yet they are all of a piece with long-standing bipartisan support for Taiwan’s defence. On July 24th a US warship made what America called a routine transit of the Taiwan Strait. In truth, much American-supplied equipment is old and vulnerable to China’s new precision-guided weapons. But the sales remain a powerful signal of America’s backing.

They also do no harm to Ms Tsai’s standing at home—the F -16s had been requested as far back as 2006. Campaigning for Taiwan’s presidential and legislative elections next January is heating up. On July 15th, in a similar primary process to the DPP ’s, the KMT named Han Kuo-yu, mayor of the city of Kaohsiung, as its presidential candidate. Voters thus face a stark choice. Mr Han, whose family hails from the mainland, is a voluble proponent of appeasing China. He says binding Taiwan more closely to China’s vast markets will bring prosperity. But it may also imperil Taiwan’s autonomy.

In contrast to the mousy Ms Tsai, Mr Han is a natural orator with a common touch. He drives crowds of older, working-class and rural followers wild. With 45% support in the primary, he blew past the runner-up, Terry Gou, a billionaire maker of iPhones, with 28%.

Mr Han calls Taiwanese independence “more scary” than syphilis. He refers to Taiwan as a region (that is, of China) rather than the country it is. Yet the Hong Kong protests have forced Mr Han to tack away from China. The Communist Party wants its formula of supposed autonomy for Hong Kong—“one country, two systems”—to apply one day to Taiwan. “Over my dead body”, Mr Han had to declare.