The government of El Salvador has announced that the nation is being given $150m by China to invest in social and technological projects, marking an unprecedented level of cooperation between Beijing and a Central American nation.

Salvadoran President Salvador Sanchez Ceren said the deal was based on “non-intervention and mutual respect”, but The New York Times reports that the burgeoning relationship has “alarmed” the US, which fears it could affect the security of the entire Americas region.

So what is behind this deal, and what does China want in return?

How did the two become friends?

The unlikely whirlwind romance began in August, when President Ceren gave a speech on national television that included “the words Beijing has long worked hard around the globe to hear”, reports the US-based National Public Radio (NPR) news site. Ceren announced that El Salavador had decided to sever its diplomatic ties with Taiwan in favour of forging a formal relationship with China.

Beijing has recently stepped up its efforts to isolate Taiwan, particularly in Central America, which is home to nine of the 17 remaining countries with ties to Taipei. El Salvador is the third nation to sever relations with Taiwan this year alone, following similar moves by the governments of Burkina Faso and the Dominican Republic.

Following the latest blow, Taiwan issued a statement condemning China’s “dollar diplomacy”, a term referring to the process whereby smaller nations agree to establish ties with Beijing in exchange for investment and aid, The Guardian explains.

Taiwan’s pro-independence president, Tsai Ing-wen, said that Beijing’s strategy of placing financial pressure on countries recognising Taiwan was based in “insecurity and lack of confidence”.

The US has also had strong words to say on the matter. The White House has accused El Salvador of falling prey to China’s interference, and has warned that China is luring countries with incentives that “facilitate economic dependence and domination, not partnership”.

But according to Taiwan’s foreign minister, Joseph Wu, El Salvador may not be so innocent. Wu claims the Central American nation had previously asked Taiwan to provide what he called an “astronomical sum” in financial aid for a port development project, a request rejected by Taipei amid fears that it might bankrupt both countries.

This was shortly before striking terms with Beijing, Wu said, hinting that China and El Salvador may have coordinated a financial conspiracy in order to justify the switch of allegiance.

President Tsai has now recalled all diplomats from El Salvador, as has the US. “We will turn to countries with similar values to fight together against China’s increasingly out-of-control international behaviour,” she said.

What does the deal entail?

Speaking in Beijing shortly after the meeting with the Salvadoran delegation, Chinese Foreign Ministry spokesperson Hua Chunying said the two countries had “agreed to a series of cooperation projects, including in infrastructure and education”.

In real terms, this means the $150m funding package, which Ceren has said will go toward “health, education, technology, water supply, prevention, care and disaster mitigation”. The El Salvador Times reports that the money will be delivered “in the next three years”. Reuters adds that China will also donate 3,000 tonnes of rice to support Salvadorans suffering the effects of drought in July and floods in October.

“China is willing to provide what help it can for El Salvador’s economic and social development. The relevant help will be focused on people’s pressing welfare needs in El Salvador,” Hua added.

But according to The Atlantic, China “is using economic leverage to pull [Central America] into its orbit”. As the news site notes, developing countries often “have a hard time securing international financing because of poor governance” yet China willingly “builds desperately needed roads, railways, and ports” - but always with a catch.

“The case of Sri Lanka is illustrative,” The Atlantic continues. “The Chinese financed and built a massive port in Hambantota that failed to draw the traffic that was expected. Sri Lanka had to lease the port back to China for 99 years and repay Beijing with money from the lease.”

One the Chinese side, there is also a pressing economic imperative at play. Facing tightening US sanctions, Beijing “has increasingly tried to appeal to the rest of the world, both for political support in the clash with the United States and to make sure China has more places to sell its products”, says the The New York Times.