Philippine President Rodrigo Duterte agreed Friday to keep the nation's Visiting Forces Agreement with the U.S. after meeting its defense chief Lloyd Austin.

In the past Duterte threatened to cancel the agreement which was signed by both countries in 1998.

Duterte agreed to keep the defense pact after discussing the new terms with the U.S. official who is on a three-day visit. Austin is the first member of U.S. President Joe Biden's cabinet to visit the Philippines. Defense Secretary Delfin Lorenzana made the official announcement following the meeting.

"The VFA is in full force again after Secretary Austin's meeting with President Rodrigo Duterte," Lorenzana said at a news conference in Camp Aguinaldo.

"We thank President Duterte for fully restoring the VFA," Austin said.

The announcement ends years of uncertainty over the fate of the agreement - a deal crucial for the U.S. and its military campaigns in Southeast Asia. Under the deal, the U.S. is able to send thousands of troops in and out of the Philippines for exercises and military drills. Analysts said the U.S. is adamant in retaining the deal given China's growing presence and influence in the region.

In January 2020, Duterte threatened to terminate the agreement, which was backed by a formal notice of termination submitted to the U.S. just a month later. The threat was made in retaliation to the U.S.'s cancellation of a visa held by a Philippine senator and political ally, who led Duterte's bloody drug war. The visa cancellation was one of many sanctions imposed by the U.S. over alleged extrajudicial killings and detention of government critics.

Despite his threats, Duterte had suspended the termination of the agreement three times. Duterte said he intended more negotiations for the restoration of the agreement.

Since Duterte came into power in 2016, the Philippines' relations with the U.S. have been complicated. He has repeatedly blasted the U.S. for its foreign policies. He has also embraced China's investment advances despite lingering territorial disputes. Several military agreements are dependent on the agreement and its termination would degrade bilateral ties.