Turkey’s ground invasion of a Kurdish enclave in northern Syria could be a boon for the Islamic State militant group (ISIS), U.S. Secretary of Defense James Mattis said on Tuesday.

Turkey has launched several airstrikes in addition to ground operations starting on Saturday in the area of Afrin, Syria, a corner of the country that Mattis described as relatively peaceful before the recent Turkish moves.

“It distracts from the international efforts to ensure the defeat of ISIS,” Mattis said, speaking to reporters between meetings in Jakarta, Indonesia. “This could be exploited by ISIS and Al-Qaeda obviously, that we’re not staying focused on them right now.”

The strikes by Turkish forces have been against Kurdish People’s Protection units, known as the YPG, in an area that borders on Turkey. Turkey believes that the YPG is supporting Kurdistan Workers’ party, or PKK, a group within Turkey that has at times violently sought independence for the Kurdish areas of the country and considered a "terrorist organization" by the Turkish government. The YPG, however, have been a critical component of the U.S.-led coalition's fight to reclaim territory in Syria from ISIS.

Mattis has been careful in his comments since the strikes began, repeatedly noting that Turkey has real security problems tied to Kurdish groups, but on Tuesday he raised concerns about how the military action could impact Afrin.

“In the Afrin area we’d actually gotten to the point where humanitarian aid was flowing, refugees were coming back in,” he said. “This clearly disrupts that effort, the Turkish incursion disrupts that effort.”

ISIS has ostensibly lost its territory in Syria, with the YPG often taking a lead position in combat, with the U.S. providing weapons and support. Turkey, a NATO ally, has been upset with the U.S. collaboration with the YPG since it began, with Turkey’s Prime Minister Binali Yıldırım warning in May that it would “surely have consequences and will yield a negative result for the U.S. as well.”

The U.S. proceeded with arming the Kurdish groups, providing a database of weapons and serial numbers to Turkey to help allay its fears.

The airstrikes and ground forces moving into Afrin follow repeated shelling of the area by Turkish artillery.

While the U.S. and its coalition try to build local police forces to maintain the peace in Syria, negotiators continue to seek a diplomatic solution to end the Syrian civil war. Mattis said that the U.S. isn’t interested in having Syrian ruler Bashar al-Assad regain control of the areas of the country liberated from ISIS.

 “We don’t want to see Assad’s regime return to Afrin,” he said. “We’re going to continue our diplomatic efforts to end the Syrian war.”