US had announced $39 million for maritime security in Sri Lanka to counter China.

Sri Lanka's President Saturday announced he will not allow his government to conclude a proposed military deal that would allow US troops free access to the island's ports.

Maithripala Sirisena said he was opposed to the draft Status of Forces Agreement (SOFA) that the two countries are negotiating to further strengthen their military ties.

Sirisena is at loggerheads with his pro-Western Prime Minister Ranil Wickremesinghe.

"I will not allow any agreement that undermines our independence and sovereignty," Sirisena told a public rally in the island's south. "Several agreements currently being discussed are detrimental to our country."

"I will not allow the SOFA that seeks to betray the nation. Some foreign forces want to make Sri Lanka one of their bases. I will not allow them to come into the country and challenge our sovereignty."

The SOFA seeks to ensure reciprocal access to port facilities and allow freer entry to military personnel and their contractors.

Sirisena said there will be no bilateral agreements "against Sri Lanka's national interest" as long as he was in office. His term ends in January.

He did not name the powers he accused of trying to gain a military foothold in his Indian Ocean island republic of 21 million people.

However, it was a thinly veiled reference to the US which is keen on strengthening their existing military cooperation.

A year ago, Washington announced it was granting $39 million to boost maritime security in Sri Lanka as China developed its strategic hold on the Indian Ocean island.

Increased US interest in Sri Lanka comes as China is upping investment in ports and other building projects on the island, which is a key link in Beijing's ambitious "Belt and Road" infrastructure initiative.

The US had stopped arms sales to Sri Lanka during the height of the island's Tamil separatist war that ended in 2009. The global power has also been highly critical of the human rights record of the former government of strongman president, Mahinda Rajapakse.

Several senior military commanders from the Rajapakse regime have been denied visas to visit the US.

China has vowed to keep providing financial help, including loans, to Sri Lanka despite warnings about the island nation's mounting debt.

Sri Lanka in 2017 granted a 99-year lease on a strategic port to Beijing because of it could not repay Chinese loans for the $1.4 billion project.

The port in Hambantota straddles the world's busiest east-west shipping route and also gives a strategic foothold to China in a region long dominated by India.