Hong Kong CNN  — 

The Philippines has reversed its decision to end an important military agreement with the United States as territorial tensions with China heat up in the South China Sea.

President Rodrigo Duterte had decided to retain the Visiting Forces Agreement (VFA) “in light of the political and other developments in the region,” said Philippine Foreign Affairs Secretary Teodoro Locsin Jr. in a social media post Tuesday.

The agreement, signed in 1988, gives US military aircraft and vessels free entry into the Philippines and relaxes visa restrictions for US military personnel.

The Philippine government gave the US 180 days’ notice to end the deal in February, suggesting that Manila needed to rely on its own resources for its defense. On Tuesday, the US welcomed the change of heart.

A US Navy landing craft offloads Marines during an exercise in the Philippines in 2019.

“Our long-standing alliance has benefited both countries, and we look forward to continued close security and defense cooperation with the Philippines,” said a statement from the US Embassy in Manila.

The Philippines was once home to two of the America’s largest military bases outside of the US: Clark Air Base and Subic Bay Naval Station.

Although those ceased to be US bases in the early 1990s, US forces still had access to them under the VFA and Manila maintained strong military ties with Washington.

But over the past few years, Duterte has been tilting away from those historical ties with the US and toward China, which has offered a closer economic relationship with Manila.

“I need China. More than anybody else at this point, I need China,” Duterte said before flying to China in April 2018.

Compared with his predecessors, Duterte has viewed the Philippines’ ongoing territorial dispute over the South China Sea as more negotiable.

Both the Philippines and China are among several nations with overlapping claims to the sea, or parts of it. China claims almost all of the South China Sea’s 1.3 million square miles as its own despite other claimants having borders that are far closer to the disputed waters.

Last year, Duterte said he had been offered a controlling stake in a joint energy deal by Chinese President Xi Jinping in exchange for ignoring an international arbitration in Manila’s favor on the South China Sea.

In 2016, a tribunal in The Hague ruled in favor of the Philippines in a maritime dispute, concluding China has no legal basis to claim historic rights to the bulk of the South China Sea.

China, however, has been stepping up its military presence on islands also claimed by the Manila.