On Monday, on the sidelines of a diplomatic summit in Manila, Secretary of State Rex Tillerson visited the Malacañan. The white Spanish colonial palace on the banks of the Pasig River has survived earthquakes, typhoons, fires, riots, and the thoroughly devastating U.S. bombing of the capital during World War II. These days, the turmoil comes mostly from the inside, thanks to its current occupant, and Tillerson’s host, President Rodrigo Duterte. For their meeting, the combative Filipino leader put aside his bombast. He greeted the American emissary with performative meekness, shuffling his feet and introducing himself as “your humble friend in Southeast Asia.”

It seemed Duterte had done a complete 180 from just two weeks before. Back on July 21, after a U.S. congressional commission condemned his lethal crackdown on impoverished drug users, which has killed at least 7,000 people, the Filipino president called a hasty hallway press conference to bring up one of his favorite topics: the United States’s ugly past. “You’re investigating me and the internal affairs of my country? I’m investigating you,” he jabbed. “I will start with your past sins. I will produce—from your archives—the photographs that you took of the people you murdered here in the Philippines.”

Duterte’s rhetorical whiplash might have seemed like another example of his mercurial—or, as he calls it, “bipolar”—nature. But while the former mayor might be combative, violent, and constantly offensive, those who know him say he is shrewd. A few hours after Duterte flattered the ExxonMobil CEO-turned-diplomat, NBC News reported, citing two defense officials, that the Pentagon was considering airstrikes to aid the Philippine army’s fight against Filipino militants allied with the Islamic State. Filipino officials denied the report, but U.S. generals have been talking about a potential operation for months. The Americans also recently gave the Filipinos surveillance planes, and U.S. special forces are on the ground in Mindanao as advisors.

Duterte’s lessons in living history are just as strategic. Following his July outburst, U.S. news outlets struggled to interpret his reference to America’s “past sins.” But Filipinos knew what he meant. Though Americans have spent a century trying to forget it, the United States’s path to global power began in the Philippines in 1898, when, on the eve of their joint victory in the Spanish-American War, President William McKinley betrayed his Filipino allies, ignored their declaration of independence, and launched his own annexation campaign of the archipelago.

Filipinos fought back. The resulting Philippine-American War left about 4,000 U.S. soldiers and more than 220,000 Filipinos dead. That conflict, and the early counterinsurgency operations that followed, were marked by American massacres of civilians, torture (including the first American experiments in waterboarding), and other atrocities. Despite stateside opposition to the widening imperial project—which soon grew to encompass other Pacific islands, parts of China, Latin America, and the Caribbean—U.S. administrations continued ruling over the Philippines until the 1940s, with American governors-general living in the Malacañan.

The U.S. colonization of the Philippines transformed both countries in language, culture, and politics. It ended only after much of the archipelago’s infrastructure and cities were destroyed in World War II—a conflict whose Pacific component the U.S. domination of the Philippines helped provoke in the first place.

For decades since, Filipino leaders avoided talking about the atrocities America would rather forget. The colonial relationship, and particularly the U.S. alliance that ended the far briefer and more vicious Japanese occupation of the 1940s, had forged a close strategic bond. And besides, as long as the U.S. remained the most powerful force in the neighborhood, there was little point in reminding them they had once been mortal enemies.

But now another power is emerging closer to the Philippines’s shores. China is projecting force for the first time in modern history, with bold moves into the South China Sea, which separates the Chinese mainland from the Philippines. The Chinese People’s Liberation Army has built up several uninhabited islands in the sea into bases with airstrips, radar, and antiaircraft guns. Duterte has been forced to flirt with the possibility of armed conflict with his huge, nuclear-armed neighbor over the Spratlys, a set of uninhabited glorified rocks that belong to the Philippines and Vietnam, but whose fishing, oil, commercial sea-lane, and military potential have led China to claim them as their own.

While the U.S. shuttered its air and naval bases in the Philippines in the 1990s—when the end of the Cold War coincided with damage to the most important installations from the volcanic eruption of Mount Pinatubo—the Philippines remains strategically important. Washington would very much like to keep the archipelago in its Pacific orbit, part of a constellation of clients and subdued former enemies, including South Korea, Taiwan, and Japan, that can act as a buffer and if need be a launchpad against anyone in Asia.

To show its continuing support, the U.S. military has sent warships to the Spratlys, most recently a guided-missile destroyer, triggering denunciations from Beijing. (That destroyer, appropriately and awkwardly, was the USS Dewey, named for the American admiral whose forces captured Manila in 1898.)

But Filipinos have doubts today’s United States can be relied on to come to the their defense. “Do you really think America will come to our aid over the Spratlys?” the powerful senator Richard “Dick” Gordon, a Duterte ally, asked me during a recent interview in Manila. Gordon, the grandson of a U.S. Marine and veritable godfather of the district that includes the former U.S. naval base at Subic Bay, knows about the power, and remorseless pragmatism, of the country at the eastern edge of the Pacific. “There is always that gray area that is reserved for those who have more power and more influence from those of us who have less,” he told me. “So how can you rely on America’s promise?”

America’s unyielding political chaos is making that uncertainty worse. In the two months after Donald Trump limped into office promising to turn U.S. power inward, a Pew Research Center global poll showed that Filipinos’ confidence in the U.S. presidency had declined from 94 percent under Obama to 69 percent. Filipinos showed strong opposition to Trump’s plans for a border wall between the U.S. and Mexico, his withdrawal from the Paris climate agreement, the scuttling of the Trans-Pacific Partnership (intended to knit Pacific countries together economically as a hedge against China, which was not a party to the agreement), and the travel ban against citizens of six Muslim-majority countries. And while Trump’s rating there was higher than in most other countries—including the United States—Filipino confidence in Chinese President Xi Jinping and Vladimir Putin was, notably, nearly as high. Overall, the poll showed that positive views of the United States had declined 14 points in the Philippines since Trump took office.

Meanwhile, China has deployed its first aircraft carrier and established its first overseas military base in the East African nation of Djibouti. In recent weeks, Chinese Foreign Minister Wang Yi announced Beijing’s strategy for an agreement on the Spratlys in the form of joint Chinese-Filipino oil exploration projects in the disputed islands. Duterte has signaled that he plans to accept the deal. In May, after welcoming three Chinese navy ships, including a guided-missile destroyer, to a Philippine port for the first time in seven years, the Filipino leader also said he would be willing to conduct joint military exercises with China. Like Washington, Beijing is aiding Duterte in his fight against Islamist militants in the southern Philippines. Xi’s government has also praised and offered financial backing for his lethal drug war.

The overtures seem to be having an effect. In an April phone call focused on bringing allies together to keep North Korea’s nuclear-weapons program in check, Duterte repeatedly shrugged off Trump’s blustering attempts at reminding him of U.S. power in the Pacific. At every turn, he responded with his intention to turn to Beijing, not Washington, to settle the crisis. “Yes, at the end of the day, the last card, the ace has to be with China. It’s only China,” he told the American president, according to a transcript obtained by The Intercept.

Trump didn’t disagree. At the end of the conversation, he invited the Filipino leader to visit the White House. (Duterte later said he was probably too busy to come.)

In that light, when Duterte brings up the brutal U.S. wars and occupations that frame the Philippines’s past, he is not just dredging up historical trivia, or even just engaging in whataboutism to distract from his own abuses—even if the comments also have that effect. He is reminding anyone who understands of the heavy price Americans and Filipinos paid for the United States’s first strategic foothold in Asia, and what America may now owe in return. Meanwhile, he is reminding Filipinos that Americans have not always been their friends, laying the groundwork for a rift as priorities change.

He has a receptive audience. While many in the islands still have warm feelings for the U.S., where millions of Filipinos live and work, there has been a surge in local interest in the Philippine-American War. That’s thanks in large part to a surprise pop-culture phenomenon: General Luna, a 2015 art-studio biopic about a brilliant but stubborn general in the Philippine-American War that became a viral hit and turned into one of the country’s highest-grossing films of all time. Fangroups calling themselves “Lunaticos Bravos” cosplay as characters from the film. A sequel about another insurgent general is now in production and a third is planned. Other studios are rumored to be considering their own projects about the era.

While the Luna craze has mostly stayed apolitical, many credit the film’s depiction of a brash, headstrong, authoritarian general with helping pave the way for Duterte’s election later that year, while inspiring a revived nationalism among a subset of young Filipinos.

True to form, Duterte has repeatedly brought up the war with the Americans in office. On several occasions, he has shown photographs of the massacre at Bud Dajo, a 1906 incident in which U.S. soldiers all but wiped out an entire Muslim village on Duterte’s home island of Mindanao. (Some reporters, including for the Washington Post, told readers that must have been what he was alluding to in July, but the spectrum of American atrocities in the islands is far wider than that single incident.)

Then on July 25, in a speech opening the annual session of the Philippine Congress, the president reminded Filipinos of yet another killing and looting spree committed by Americans—this one on the island of Samar, in 1900. That campaign, ordered by a U.S. general in response to an insurgent attack on U.S. forces in the town of Balangiga, included the capture of church bells witnesses said were used to signal the initial ambush. Those bells, still held as war trophies by the U.S. Army at bases in Wyoming and South Korea, remain a potent symbol of national humiliation. Filipinos have been demanding their return for decades. Duterte also reportedly brought up the bells in his meeting with Tillerson, according to local media.

Tillerson was in Manila to observe diplomatic meetings hosted by ASEAN, the Southeast Asian regional bloc, to which Russia, China, and Japan also sent representatives. North Korea’s foreign minister used the meeting to plead his country’s case. On the South China Sea front, after days of debate and delays, ASEAN members put out a muted statement noting concern about militarization and island-building. China warned it will hold talks aimed at resolving the standoff only if there is no meddling by “outside parties”—a clear reference to the United States. Many observers saw the summit as a win for Beijing.

Filipino leaders have long known their archipelago is a strategic outpost for other empires. The question has always been how to use that position to their advantage. It will be telling to see which Duterte—the historian-insurgent or humble friend—greets Trump when he arrives at the ASEAN presidential summit, as he is expected to do, in November.