ISTANBUL—Two weeks after U.S. President Donald Trump called Turkish President Recep Tayyip Erdoğan to congratulate him on winning a referendum that critics say will lead to one man rule, the Turkish leader has launched a new domestic crackdown and signaled that he is ready to confront the United States over the two countries’ sharply divergent polices in Syria. And if that showdown worsens, U.S. troops there could be in harm’s way.

This comes at a time when Trump appears to be courting strongmen around the world in hopes the power of his personality as well as his position can win concessions and cooperation. Most recently, Trump has called North Korea’s Kim Jong Un “a smart cookie” and said he would be “honored” to meet with him directly “under the right circumstances.”

The Turkish experience should be taken as a cautionary example. Erdoğan essentially pocketed Trump’s endorsement of the referendum, and apparent lack of concern about human rights violations, but continues to pursue national security policies that directly conflict with Washington’s agenda—even as he prepares to meet with Trump at the White House on May 16.

By any measure, Erdoğan’s actions appear provocative for a NATO ally who has been hoping to inaugurate a new era of improved relations with the United States after bitter enmity in the last years of the Obama administration.

In their phone call after the referendum, according to the White House readout, Trump and Erdoğan “discussed the counter-ISIS campaign and the need to cooperate against all groups that use terrorism to achieve their ends.”

But clearly there’s been no meeting of the minds.

The Turkish armed forces last week launched unprecedented bombing raids against U.S.-allied Kurdish militias in Syria and Iraq, and when the U.S. protested over the lack of advance consultation, the Turks carried out still more air and artillery strikes. The Turkish military said it killed 89 “terrorists.”

But Erdoğan wasn’t the only one sending signals.

The U.S. military responded by sending out joint patrols along the Syrian-Turkish border with U.S. soldiers alongside members of the People’s Protection Force (YPG) militia that Erdoğan had bombed, and then it sent representatives to inspect the damage and to attend the funerals for some of those killed.

On Sunday, Erdoğan threw down the gauntlet. “This needs to end,” he said. “Otherwise we will have to take the matter in our own hands.”

At issue is the plan the Trump administration is preparing to conquer Raqqa, the self-styled capital in northeast Syria of the Islamic State extremists.

The U.S. military strongly favors continuing to utilize the YPG militia as its ground force, ignoring its direct link with the Kurdistan Worker’s Party (PKK), the Kurdish separatist movement which is at war with Turkey.

Erdoğan has repeatedly stated that its NATO ally should not be fighting one terrorist group with another and has offered to send Turkish forces, along with trained Syrian rebel groups, in their stead.

Anadolu, the state-run news agency, posted a graphic Monday, charging that U.S. cooperation with the PKK and its Syrian affiliate violates the NATO treaty, which binds its parties to maintain and develop each other’s security.

Warning of a Turkish unilateral attack, Erdoğan said Sunday: “We may come overnight, all of a sudden without warning.”

Erdoğan’s tone and actions seemed abrasive in comparison with Trump, who usually is the one accused of flaunting an aggressive, undiplomatic communications style. In fact, Trump has dealt with Erdoğan with kid gloves, making the much-publicized phone call and the invitation to come to Washington.

Both gestures stood in stark contrast to Obama, who waited for four days after the failed coup against Erdoğan last year before calling with reassurance of U.S. backing.

Erdoğan may be trying to show political muscle after the highly contentious constitutional referendum. The main opposition, the Republican People’s Party, is refusing to recognize the result of the referendum, which international observers criticized as unfairly structured to boost the “yes” vote.

But the other factor in Erdoğan’s posture is that successive U.S. administrations have underestimated the importance of the Kurdish issue. It is not only Turkey’s topmost national security concern but it also is a big issue in domestic politics, where Erdoğan enjoys widespread support across party lines for a tough stance against the Kurdish separatists.

As he challenges Trump to change his plans for fighting ISIS, Erdoğan has also been carrying out a domestic crackdown. On May 16, the night he claimed victory in the referendum, Erdoğan extended the state of emergency that he ordered after the abortive military coup last July, which allows him to rule by decree for three more months.

He suspended more than 9,000 police officers and detained more than 1,000 others, claiming they were “secret imams” or ringleaders. All are accused of having links with Fethullah Gülen, an Islamic cleric living in the U.S. whom Erdoğan charges had organized the failed coup attempt.

Over the weekend new decrees dismissed nearly 4,000 public officials from their posts. More than 100,000 public officials have been suspended from their posts since last July.

But the crackdown extended into social life and the internet as well. The government’s communications oversight board blocked all access to Wikipedia, the internet encyclopedia for “acting with groups conducting a smear campaign against Turkey,” according to the Anadolu news agency.

A close reading of some of the key articles about Turkey revealed a critical slant, backed up by specific citation. Several of the articles cited contained allegations that Erdoğan’s government had economic or other ties with ISIS. For the most part they lacked a response from the Turkish government, but that’s also because Erdoğan, who’s reduced press freedom dramatically at home, has tightly restricted the availability of government officials to the news media.

Another emergency decree this past weekend banned all television dating programs. The independent newspaper Hürriyet reported officials of Erdoğan’s Justice and Development Party (AKP) had said the shows receive thousands of complaints every year. But the move appeared to be a gesture to Erdoğan’s key conservative Muslim constituency.

The orders were issued without an official statement or any further explanation. Hürriyet quoted an opposition party official as saying such sweeping laws remove the function of parliament. “Was the coup attempt staged by marriage programs,” Sezgin Tanrikulu was quoted as saying. “Was the state of emergency issued to address marriage programs?”