When Turkey finally agreed to join U.S.-led efforts to fight Islamic State, Ankara was supposed to make the battle against the extremist group more effective. Yet within days, Turkey’s president, Recep Tayyip Erdogan, bombed not just Islamic State forces but also, with even greater fervor, the one group showing some success in keeping them at bay: the Kurds.

The United States miscalculated by bringing in Erdogan. Turkey’s embattled and volatile leader looks far less interested in combating Islamic State than in reclaiming his power at home. Erdogan’s personal agenda, however, cannot be allowed to alienate U.S. partners and prolong the conflict.

Washington’s first priority here should be to preserve its constructive alliances with Kurdish groups in the fight against Islamic State. It must also prevent Turkey from further undermining the key strategic goal of defeating the jihadists.

So U.S. officials should be taking a far stronger stance against Erdogan’s attacks on the Kurds. One complicating factor is that both Ankara and Washington have labeled the target of Turkish operations — the Kurdistan Workers Party (PKK) — a terrorist organization. But there are related Kurdish organizations that U.S. leaders can and should approach, publicly reassure and privately work with to maintain their cooperation against Islamic State.

First, the Syrian Kurdish political movement, the Democratic Union Party, though ideologically related to the PKK, is considered a separate organization and not designated as a terrorist group under U.S. law. Its leader, Saleh Muslim, should be invited to Washington expeditiously for high-level consultations with government officials. These meetings could publicly demonstrate Washington’s continued commitment to the Syrian Kurds.

Second, Turkey’s pro-Kurdish political party, the Peoples’ Democratic Party, is increasingly popular because it represents the aspirations of the vast majority of Turkey’s Kurds to reach a peaceful solution to the long civil conflict, as well as many Turks who want a more democratic, liberal Turkey. The party’s success in the June general elections was tremendous; it won seats in parliament for the first time. Yet the government has recently opened an investigation into the party’s leader, Selahattin Demirtas, that many critics say is politically motivated. The U.S. ambassador to Turkey should meet with Demirtas and express Washington’s continued support for concluding a peace process between Turkey and the Kurdistan Workers Party.

Third, the Kurdistan Regional Government in northern Iraq remains the most important of all the Kurdish factions. It might also be least likely to abandon the anti-Islamic State coalition over Turkish actions because of its close economic ties to Ankara and ideological opposition to the PKK. But if the regional government were to abandon the coalition, U.S. forces could lose access to critical operational, planning and intelligence facilities. So U.S. officials would do well to reassure Kurdish leaders of Washington’s commitment to their safety. They should also agree on a joint approach to pressure Erdogan to end his campaign against the PKK.

Another priority for U.S. officials should be to remove Erdogan’s motivation for attacking the Kurdistan Workers Party: political survival.

In June, Turkish voters handed Erdogan a significant defeat. His Justice and Development Party, after 12 years of single-party rule, failed to secure even a simple majority in parliament. Ever since, Erdogan had been searching for an excuse to call early elections and cajole the voters who deserted him to return to the fold. War offered the perfect opportunity.

Turkey, Erdogan told the nation, is under siege, its enemies legion. He has positioned himself as the only leader capable of protecting his people. He has also presented himself as an important and respected player on the world stage after striking a deal with the United States and getting North Atlantic Treaty Organization support for his war.

By denying Erdogan’s campaign any imprimatur of international legitimacy, the United States could begin to cut down on the political benefit he is seeking to accrue. This could mean U.S. officials openly questioning Turkey’s attack on the PKK and highlighting how it jeopardizes the mission against Islamic State — and therefore Turkish lives — rather than suggesting that the two are merely “coincidental.” The United States should be prepared to go a step further and speak frankly about the many concerns that have arisen in the U.S.-Turkish relationship during Erdogan’s administration.

Washington has continually overlooked Erdogan’s growing list of political and strategic sins –including jailing journalists at home and supporting extremists in Syria — in the hope that, when it really needed him, he would rise to the occasion. There has been no greater need for Turkey than in the fight against Islamic State. Yet after displaying reluctance to join the fight for 10 months, Erdogan has placed his own ambitions ahead of his country’s and his allies’ interests.

There is no good reason for U.S. officials to continue biting their tongues regarding Erdogan’s dictatorial tendencies and his rejection of Turkey’s traditional Western orientation.

It might have been a miscalculation to bring Erdogan into this conflict. But if the United States could stick by its Kurdish partners and chastise Erdogan’s recklessness, he might realize that he is the one who has finally overplayed his hand.