China signed a deal with Sri Lanka late last year to further develop the strategic port of Hambantota and build a huge industrial zone nearby, a key part of Beijing's ambitions to create a modern-day “Silk Road” across Asia.
The agreement was welcome relief for the island nation of 20 million people.
As they try to reduce the country's debts, officials in Colombo see China's plans to include Sri Lanka on its “One Belt, One Road” initiative as an economic lifeline.
China has spent almost $2 billion so far on Hambantota and a new airport and wants to spend much more.
But Beijing now faces a new and unpredictable challenge to its presence in Sri Lanka and broader Silk Road project.
Hundreds of Sri Lankans clashed with police at the opening last month of the industrial zone in the south, saying they would not be moved from their land.
It was the first time opposition to Chinese investments in Sri Lanka turned violent.
Leading the campaign against the latest deal, which he says is too generous to China, is former President Mahinda Rajapaksa, an influential opposition politician who first allowed Chinese investment in Sri Lanka when he was leader from 2005-15.
The clashes, in which demonstrators threw stones and police used tear gas and water cannon, underlined the depth of resentment at China's expansion felt by some local people, who feared they would be forced from their homes.
The Chinese foreign ministry said Beijing was doing what was best for both countries.
The Chinese embassy in Colombo did not respond to a request for comment on investments in Sri Lanka.
The Sri Lankan protests are not the first sign of opposition to China's One Belt plans to build land corridors across Southeast Asia, Pakistan and Central Asia and maritime routes opening up trade with the Middle East and Europe.
Rail links from China through Laos and Thailand have hit the buffers over resistance to what they say are Beijing's excessive demands and unfavourable financing.
'Impinges on sovereignty'
Under the original deal negotiated by Rajapaksa during his tenure, the container terminal at Hambantota was to be operated by a joint venture between China Harbour Engineering Co and state-run China Merchants Port Holdings for 40 years.
The Port Authority of Sri Lanka would retain control of all other terminals in the harbour, as well as a 6,000 acre industrial zone.
But last month, the administration of Rajapaksa's successor President Maithripala Sirisena, who came to office threatening to cancel high-value Chinese contracts on the grounds they were unfair, approved a deal to lease 80 per cent of the port to China Merchants Port Holdings for $1.12bn.
The company also got the lease for 99 years.
Officials said Sirisena's hand was forced by the country's high debt burden and the fact that inflows from countries including India and the United States were less than expected, despite a $1.5bn, three-year IMF loan programme agreed last year.
“A 99-year lease impinges on Sri Lanka's sovereign rights, because a foreign company will enjoy the rights of the landlord over the free port and the main harbour,” said Rajapaksa.
“This is not an issue with China or with foreign investors. It is about getting the best deal for Sri Lanka,” he told Reuters in an interview.
The government also announced the lease of a much bigger 15,000 acres of land around the port for an industrial zone controlled by China Merchants Port Holdings, which has become a lightning rod for protests.
The demonstrators said they feared eviction from their land to make way for the site, a concern that China put down to a misunderstanding.
“Chinese companies have from the very start upheld the holding of talks and consultations with Sri Lanka on the basis of one's own free will, equality and mutual respect according to market principles,” said Chinese foreign ministry spokeswoman Hua Chunying.
China Merchants Port Holdings declined to comment on the protests.
'We are not leaving'
China has spent $1.7bn building Hambantota port and the adjacent Mattala Rajapaksa airport, named after the former president, both of which are under-utilised and losing money.
Losses at the port added up to around $230m in the five years to the end of 2016, according to the Sri Lankan finance ministry.
China's ambassador to Sri Lanka, Yi Xianliang, said the country would invest $5bn more in the next three to five years and create 100,000 jobs “if everything goes well.”
Last week, a policeman stood guard at the foundation stone of the proposed new zone in a forest clearing in Hambantota to prevent protesters from marching on the area.
“We are firmly against this project. We don't want our land to be given to the Chinese.
We are not leaving the area,” said Upul Dhammika, a farmer whose land is located where the government has tried to survey for the industrial zone.
Sleepy outpost
Rajapaksa questioned the need for the Chinese to be given 15,000 acres, which he said was more than three times the area of all other economic zones in the country combined.
Isolated from the West over allegations of human rights abuses during the country's civil war, Rajapaksa struck major deals with the Chinese when he was in power, including Hambantota and the nearby airport.
Sirisena, elected two years ago, vowed to review some of those agreements, including a $1.4bn “port city” in the capital Colombo which was put on hold in 2015.
That, said a Chinese source with knowledge of the recent negotiations, upset Beijing, and so it pushed for the best possible deal on Hambantota.
“They (China) were really angry with the new government, until it agreed (to) an 80pc port deal,” the source said, speaking on condition of anonymity because of the sensitivity of the talks.
The Chinese embassy in Colombo did not respond when asked about that aspect of the negotiations.
Beijing also threatened lawsuits when the new administration sought to review some of the old agreements, an official in the international trade ministry said.
China's position was that it won the contracts on merit and a change of government should not have a bearing on these deals.
Sri Lankan Port Minister Arjuna Ranatunga said Hambantota port was losing money and the government had to go for a debt-for-equity deal to reduce the financial burden on the country.
Sri Lanka's national debt stands at around $64bn, or 76pc of gross domestic product, one of the highest among emerging economies. It owes China over $8bn.
For now, Hambantota remains a sleepy outpost. Four years after the port and airport were completed, there is one flight a day and barely five to six ships docking each week.
The highway leading to the town is largely deserted, a new conference hall is unused and even a large cricket stadium built by the Chinese is used mainly for wedding receptions.