BEIJING — For years, the United States and its allies have struggled to contain China’s ambitions in the South China Sea, even as China steadily seeded the waters with artificial islands and military installations.

Now, by cutting its own deal with China, the Philippines has suddenly changed the calculus, persuading the Chinese to let its fishermen operate around a disputed shoal but setting a worrying precedent for the United States and its hopes of using regional alliances to preserve its place as the dominant power in the Pacific.

What had been a fairly united front against China’s expanding maritime claims, stretching from Japan to Malaysia, now has a gap in the southeast corner where the Philippines lies, and could soon have another at the southwestern end, where Malaysia is making noises about shifting its alliances.

In both cases, resentment over what is seen as American interference in unrelated problems — a wave of extrajudicial killings in the Philippines and a huge financial scandal in Malaysia — may have contributed to the shift.