China signed a deal with Sri Lanka in late 2016 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 in January 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 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.
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.12 billion.
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.5 billion, three-year IMF loan program 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 has spent $1.7 billion building Hambantota port and the adjacent Mattala Rajapaksa airport, both of which are under-utilised and losing money.
China's ambassador to Sri Lanka, Yi Xianliang, said the country would invest $5 billion more in the next three to five years and create 100,000 jobs "if everything goes well."