Turkey’s President said his country “admires and embraces” Qatar’s attitude, while slamming the demands by arguing they contradict international law.

Turkey’s President on Sunday rejected a demand by major Arab states to remove Turkish troops from Qatar, saying their sweeping list of ultimatums has threatened the small Gulf country’s sovereignty.

Speaking after Eid al-Fitr prayers in Istanbul, President Recep Tayyip Erdogan called the demand “disrespectful” and said Turkey would not seek permission from others when making its defense cooperation agreements.

“Demanding that Turkey pull its soldiers is unfortunately also disrespectful toward Turkey,” he said.

In a sign of support, the Turkish parliament swiftly ratified a 2014 military agreement with Qatar earlier this month, allowing the deployment of troops to its base there. The military said a contingent of 23 soldiers reached Doha on Thursday. Turkey has also shipped supplies and food via cargo planes after

Mr. Erdogan said he made a similar offer to Saudi Arabia to set up a base there in the past but did not hear back from the king.

A Turkish foreign ministry statement on Sunday reiterated that the deployment of Turkish troops in Qatar contributed to regional security and was not aimed at a specific country.

“Just like the presence of other foreign military bases or units in other countries of the region, our military presence in Qatar is principally based on a decision taken by the two countries relying on their sovereign rights,” ministry spokesman Huseyin Muftuoglu said.

Doha received a 13-point list from Saudi Arabia, United Arab Emirates, Egypt and Bahrain that included demands to shut down the media network Al-Jazeera and cut ties with Islamist groups including the Muslim Brotherhood. The energy-rich country said it was reviewing the ultimatum but added it would not negotiate under siege.

Turkey’s President said his country “admires and embraces” Qatar’s attitude, while slamming the demands by arguing they contradict international law.

“Here we see an attack against a state’s sovereignty rights,” Mr. Erdogan said.

Mr. Erdogan called the demand that Qatar shut down Al-Jazeera an attempt to take away the network’s press freedom and urged rights groups to speak out against that.

Mr. Erdogan spoke to journalists after experiencing a diabetes-related blood pressure problem during prayers marking the end of the holy month of Ramadan.