Beijing grumbled but swallowed its irritation in 1997 when then-Speaker Newt Gingrich of the U.S. House of Representatives visited Taiwan, the island democracy claimed by the mainland’s ruling Communist Party as its own territory.

China had other priorities. President Jiang Zemin’s government was preparing to celebrate Hong Kong’s return and wanted to lock in Beijing’s emergence from diplomatic isolation after its 1989 crackdown on pro-democracy demonstrations in Tiananmen Square. Gingrich, a booster of closer U.S.-Chinese ties, had just helped that campaign by meeting Jiang in Beijing. China avoided a disruptive clash with Washington.

A quarter-century later, conditions have changed drastically. Chinese President Xi Jinping’s government is richer, more heavily armed and less willing to compromise over Taiwan following news reports the current speaker, Nancy Pelosi, might become the most senior U.S. official since Gingrich to visit the island.

Beijing sees any official contact with Taiwan as recognition of its democratically elected government, which the mainland says has no right to conduct foreign relations.

The timing adds to political pressure. Xi is widely expected to try to award himself a third five-year term as party leader at a meeting in the autumn. That could be undercut if rivals can accuse Xi of failing to be tough enough in the face of what they consider American provocation.

Pelosi has yet to confirm whether she might visit, but Beijing is warning of “forceful measures” including military action if she does.

The United States “must not arrange for Pelosi to visit Taiwan,” a Chinese Ministry of Defense spokesman, Tan Kefei, said Tuesday.

“If the United States goes ahead with this, the Chinese military will never watch and do nothing,” Tan said. “It will take strong measures to thwart any external interference and separatist plans for ‘Taiwan independence’ and resolutely defend national sovereignty and territorial integrity.”

Tan referred to Pelosi as “No. 3 in the U.S. government,” after her place in the line of succession to become president. That suggests Beijing sees her as President Joe Biden’s subordinate, instead of his equal as head of one of three independent branches of the government.

Biden told reporters the American military thinks a visit is “not a good idea right now.” But, possibly in deference to her position, the president hasn’t said Pelosi shouldn’t go. U.S. officials told The Associated Press that if Pelosi goes, the American military would likely use fighter jets, ships and other forces to provide protection for her flight.

Chinese rhetoric about that is “quite disturbing,” the chairman of the Joint Chiefs of Staff, Gen. Mark Milley, told the Australian Broadcasting Corp. “If we’re asked, we’ll do what is necessary in order to ensure a safe visit.”

U.S. officials have said the administration doubts China would take direct action against Pelosi herself or try to sabotage the visit. But they don’t rule out the possibility that China could escalate provocative flights of military aircraft in or near Taiwanese airspace and naval patrols in the Taiwan Strait should the trip take place. And they don’t preclude Chinese actions elsewhere in the region as a show of strength.