Photo/Illutration A member of the Philippine Coast Guard holds flags during the arrival of Chinese naval training ship, Qi Jiguang, for a goodwill visit at Manila's port, Philippines, June 14, 2023. (AP Photo)

MANILA--China and the Philippines reached a deal they hope will end confrontations at the most fiercely disputed shoal in the South China Sea, the Philippine government said Sunday.

The Philippines occupies Second Thomas Shoal but China also claims it, and increasingly hostile clashes at sea have sparked fears of larger conflicts that could involve the United States.

The crucial deal was reached Sunday, after a series of meetings between Philippine and Chinese diplomats in Manila and exchanges of diplomatic notes that aimed to establish a mutually acceptable arrangement at the shoal, which Filipinos call Ayungin and the Chinese call Ren’ai Jiao, without conceding either side’s territorial claims.

Two Philippine officials, who had knowledge of the negotiations, confirmed the deal to The Associated Press on condition of anonymity and the government later issued a brief statement announcing the deal without providing details.

“Both sides continue to recognize the need to deescalate the situation in the South China Sea and manage differences through dialogue and consultation and agree that the agreement will not prejudice each other’s positions in the South China Sea,” the Department of Foreign Affairs in Manila said.

China’s Ministry of Foreign Affairs announced shortly after midnight Sunday that they discussed with the Philippines “managing the situation at Ren’ai Jiao and reached provisional arrangement with the Philippines on humanitarian resupply of living necessities.”

Neither side released the text of the agreement.

China has disputes with several governments over land and sea borders, many of them in the South China Sea. The rare deal with the Philippines could spark hope that similar arrangements could be forged by Beijing with other countries to avoid clashes while thorny territorial issues remain unresolved. It remains to be seen, however, if the deal could be implemented successfully and how long it will last.

Chinese coast guard and other forces have used powerful water cannons and dangerous blocking maneuvers to prevent food and other supplies from reaching Filipino navy personnel at Manila’s outpost at the shoal, on a long-grounded and rusting warship, the BRP Sierra Madre.

The yearslong territorial standoff has flared repeatedly since last year.

In the worst confrontation, Chinese forces on motorboats repeatedly rammed and then boarded two Philippine navy boats on June 17 to prevent Filipino personnel from transferring food and other supplies including firearms to the ship outpost in the shallows of the shoal, according to the Philippine government.

The Chinese seized the Philippine navy boats and damaged them with machetes and improvised spears. They also seized seven M4 rifles, which were packed in cases, and other supplies. The violent faceoff wounded several Filipino navy personnel, including one who lost his thumb, in a chaotic skirmish that was captured in video and photos that were later made public by Philippine officials.

China and the Philippines blamed each other for the confrontation and each asserted their own sovereign rights over the shoal.

The United States and its key Asian and Western allies, including Japan and Australia, condemned the Chinese acts at the shoal and called for the rule of law and freedom of navigation to be upheld in the South China Sea, a key global trade route with rich fishing areas and undersea gas deposits.

In addition to China and the Philippines, Vietnam, Malaysia, Brunei and Taiwan have been locked in separate but increasingly tense territorial disputes in the waterway, which is regarded as a potential flashpoint and a delicate fault line in the U.S.-China regional rivalry. The U.S. military has deployed Navy ships and fighter jets for decades in what it calls freedom of navigation and overflight patrols, which China has opposed and regards as a threat to regional stability.

Washington has no territorial claims in the disputed waters but has repeatedly warned that it is obligated to defend the Philippines, its oldest treaty ally in Asia, if Filipino forces, ships and aircraft come under an armed attack, including in the South China Sea.

One of the two Philippine officials said the June 17 confrontation prompted Beijing and Manila to hasten on-and-off talks on an arrangement that would prevent confrontations at Second Thomas Shoal.

During final meetings in the last four days, two Chinese demands that had been key sticking points were removed from the draft deal.

China had previously said it would allow food, water and other basic supplies to be transported by the Philippines to its forces at the shoal if Manila agreed not to bring construction materials to fortify the crumbling ship and to give China advance notice and the right to inspect the ships for those materials, the officials said.

The Philippines rejected those conditions, and the final deal did not include them, according to the Philippine officials.