Turkey has maintained low-level contact with the Syrian government, President Recep Tayyip Erdogan said on Sunday, even though Ankara has supported rebels who fought for years to topple President Bashar Assad.

Erdogan has described Assad as a terrorist and said several times during Syria’s eight-year conflict that the Syrian leader must go. But with support from Russia and Iran, Assad had recaptured large parts of Syria from rebel fighters, driving them from most of their former strongholds.

Foreign Minister Mevlut Cavusoglu said in December Turkey and other countries would consider working with Assad if he won a democratic election, and last month said Ankara was in indirect contact with Damascus via Russia and Iran.

Erdogan said on Sunday that Turkey also had direct contacts with the Syrian government.

“Foreign policy with Syria continues at a lower level,” he told broadcaster TRT in an interview, adding that intelligence services operated differently to political leaders.

“Leaders may be cut out. But intelligence units can communicate for their interests,” Erdogan said. “Even if you have an enemy, you should not break ties. You may need that later.”