(BBC) When US President Joe Biden recently signed off on a $80m (£64.6m) grant to Taiwan for the purchase of American military equipment, China said it "deplores and opposes" what Washington had done.
To the casual observer it didn't appear a steep sum. It was less than the cost of a single modern fighter jet. Taiwan already has on order more than $14bn worth of US military equipment. Does a miserly $80m more matter?
While fury is Beijing's default response to any military support for Taiwan, this time something was different.
The $80m is not a loan. It comes from American taxpayers. For the first time in more than 40 years, America is using its own money to send weapons to a place it officially doesn't recognise. This is happening under a programme called foreign military finance (FMF).
Since Russia's invasion of Ukraine last year, FMF has been used to send around $4bn of military aid to Kyiv.
It has been used to send billions more to Afghanistan, Iraq, Israel and Egypt and so on. But until now it has only ever been given to countries or organisations recognised by the United Nations. Taiwan is not.
After the US switched diplomatic recognition from Taiwan to China in 1979, it continued to sell weapons to the island under the terms of the Taiwan Relations Act. The key was to sell just enough weapons so Taiwan could defend itself against possible Chinese attack, but not so many that they would destabilise relations between Washington and Beijing. For decades, the US has relied on this so-called strategic ambiguity to do business with China, while remaining Taiwan's staunchest ally.
But in the last decade the military balance across the Taiwan Strait has tipped dramatically in China's favour. The old formula no longer works. Washington insists its policy has not changed but, in crucial ways, it has. The US State Department has been quick to deny FMF implies any recognition of Taiwan. But in Taipei it's apparent that America is redefining its relationship with the island, especially so given the urgency with which Washington is pushing Taiwan to re-arm. And Taiwan, which is outmatched by China, needs the help.
"The US is emphasising the desperate need to improve our military capacity. It is sending a clear message of strategic clarity to Beijing that we stand together," says Wang Ting-yu, a ruling party legislator with close ties to Taiwan's President Tsai Ing-wen, and to US Congressional chiefs.
He says the $80m is the tip of what could be a very large iceberg, and notes that in July President Biden used discretionary powers to approve the sale of military services and equipment worth $500m to Taiwan.
How China is fighting in the grey zone against Taiwan
Taiwan unveils new submarine to fend off China
Mr Wang says Taiwan is preparing to send two battalions of ground troops to the US for training, the first time this has happened since the 1970s.
But the key is the money, the beginning of what, he says, could be up to $10bn over the next five years.
Deals involving military equipment can take up to 10 years, says Lai I-Ching, president of the Prospect Foundation, a Taipei-based think-tank. "But with FMF, the US is sending weapons directly from its own stocks and it's US money - so we don't need to go through the whole approval process." This is important given that a divided Congress has held up billions of dollars worth of aid for Ukraine, although Taiwan appears to have far more bipartisan support.
But the war in Gaza will undoubtedly squeeze America's weapons supply to Taipei, as has the war in Ukraine. President Biden is seeking war aid for Ukraine and Israel, which includes more money for Taiwan too.
Ask the Ministry of National Defence in Taipei what US money will be used for, and the response is a knowing smile and tightly sealed lips.
But Dr Lai says it's possible to make educated guesses: Javelin and Stinger anti-aircraft missiles - highly effective weapons that forces can learn to use quickly.
"We don't have enough of them, and we need a lot," he says. "In Ukraine, the Stingers have run out very quickly, and the way Ukraine has been using them suggests we need maybe 10 times the number we currently have."
The assessment of long-time observers is blunt: the island is woefully under-prepared for a Chinese attack.
A spooked and lonely Taiwan looks for new friends
The laidback Australian city key to countering China
The list of problems is long. Taiwan's army has hundreds of ageing battle tanks, but too few modern, light missile systems. Its army command structure, tactics and doctrine haven't been updated in half a century. Many front-line units have only 60% of the manpower they should have.
Taiwan's counter-intelligence operations in China are reportedly non-existent and its military conscription system is broken.
In 2013 Taiwan reduced military service from one year to just four months, before reinstating it back to 12 months, a move that takes effect next year. But there are bigger challenges. It's jokingly referred to as a "summer camp" by the young men who go through it.
"There was no regular training," says a recent graduate. "We would go to a shooting range about once every two weeks, and we would use old guns from the 1970s. We did shoot at targets. But there was no proper teaching on how to aim, so everyone kept missing. We did zero exercise. There's a fitness test at the end, but we did no preparation for it."
He described a system in which senior army commanders view these young men with utter indifference and have zero interest in training them, in part because they will be there for such a short time.
In Washington there is a strong sense that Taiwan is running out of time to reform and rebuild its military. So, the US is also starting to retrain Taiwan's army.
For decades, the island's political and military leaders have leant heavily on the belief that invading the island is much too difficult and risky for China to attempt. Rather like Britain, Taiwan prioritised its navy and air force - at the expense of its army.
"The idea was to engage them in the Taiwan Strait and annihilate them on the beaches. So, we put lots of resources into air and sea defence," says Dr Lai.
But now China has the world's largest navy and a far superior air force. A war-gaming exercise conducted by a think-tank last year found that in a conflict with China, Taiwan's navy and air force would be wiped out in the first 96 hours of battle.
Under intense pressure from Washington, Taipei is switching to a "fortress Taiwan" strategy that would make the island extremely difficult for China to conquer.
The focus will switch to ground troops, infantry and artillery - repelling an invasion on the beaches and, if necessary, fighting the People's Liberation Army (PLA) in the towns and cities, and from bases deep in the island's jungle-covered mountains. But this puts the responsibility for defending Taiwan back on its outdated army.
"After the US cut relations in 1979 our army experienced almost complete isolation. So they are stuck in the Vietnam War-era of US military doctrine," Dr Lai says.
This didn't worry Taipei or Washington until more recently. Through the 1990s and 2000s Taiwanese and US companies were building factories across China.
Beijing was lobbying to join the World Trade Organization - and did. The world embraced the Chinese economy, and the US thought trade and investment would secure peace in the Taiwan Strait.
But the rise of Xi Jinping, and his brand of nationalism, and Russia's invasion of Ukraine have blown apart those comforting assumptions.
For Taiwan the lessons from Ukraine's invasion have been shocking. Artillery has dominated the battlefield - it has a high rate of fire and is terrifyingly accurate.