ISTANBUL - When Turkish President Recep Tayyip Erdogan inspected troops at the Syrian border, the visit to the southern province of Hatay made headlines not for what the 64-year-old leader told the soldiers but for what he was wearing. Erdogan appeared not in his usual suit and tie but in full battle fatigues.

For Turks who remember Erdogan’s early days as the leader of a party inspired by political Islam, the change was astounding. After becoming prime minister in 2003, Erdogan spent the first years in power sparring with the strictly secular generals who publicly threatened to topple him in 2007.

The military has pushed four Turkish governments from power since 1960 but Erdogan ended the military’s role as a self-appointed guardian of the secular republic in 2011. He has sought closer ties with the military leadership since.

The recent operation to occupy the Syrian region of Afrin and an earlier incursion into the neighbouring country in 2016, both ordered by Erdogan as commander-in-chief, are signs that — for better or for worse — Turkey’s military is answerable to the civilian government in ways that are new for the country.

“Regardless of what anyone thinks about the justness of Ankara’s cause in Syria, civilian control of the armed forces in Turkey is now a reality,” Steven Cook of the Council on Foreign Relations in Washington wrote in Foreign Policy magazine. “That is something quite new. The very real danger given Erdogan’s authoritarian worldview and approach to politics is that he transforms the military into an instrument of his transformative vision for Turkey.”

Critics say the danger described by Cook has become a reality. They accuse Erdogan of launching the incursion into Afrin to create a wave of patriotism ahead of crucial parliamentary and presidential elections called by him for June 24. Long seen as an institution that is above the fray of day-to-day politics, the military is considered by some in Turkey as a tool of the government election campaign. Erdogan wants to use a win at the polls in June to secure wide-ranging powers for himself under a new presidential system.

Given the high political stakes, the opposition’s response to Erdogan’s choice of battle dress during the Hatay visit was scathing. Bulent Tezcan, spokesman of the secular Republican People’s Party (CHP), said Afrin, which borders Hatay and was occupied by Turkey in March, was a “place where martyrs shed their blood,” the word used in Turkey for soldiers killed in war. “This is not a place to put on a show with a uniform.”

Another reason opposition officials were angry was that Erdogan took prominent Turkish singers with him to Hatay as a morale booster for the troops. CHP leader Kemal Kilicdaroglu accused Erdogan of dishonouring soldiers killed in the Afrin operation for the sake of a publicity stunt.

Kilicdaroglu visited the troops in Hatay a few days after Erdogan, triggering criticism from the president. “What is your business in Hatay?” Erdogan asked in a speech, addressing Kilicdaroglu.

The campaign-style exchange between the head of state and the opposition leader over the army demonstrates that the political fight about who is closest to the military is heating up. So far, Erdogan is winning. He has even called on composers to come up with an “Afrin March” to celebrate the exploits of the army in Syria.

“Although there is widespread recognition among the public that Erdogan has eroded the institutions and traditions of the Turkish military, the rally-round-the-flag effect of cross-border operations into northern Syria has offset this sentiment,” Aykan Erdemir, a former member of Turkey’s parliament who works for the Washington think-tank Foundation for Defense of Democracies, said via e-mail.

Turkey’s army, NATO’s biggest fighting force after the US military, is a conscription outfit of 500,000 men. All able-bodied males are expected to serve; Erdogan served as a conscript near Istanbul in 1982. The main pillar of public respect for the army is the decisive role the military played in the creation of modern Turkey following the first world war. The founder and first president of the republic, Mustafa Kemal Ataturk, was a former Ottoman general.

Decades of guerrilla warfare against Kurdish rebels in south-eastern Anatolia have hardened the Turkish public against the sight of coffins arriving from the battlefields. Burials of “martyrs” are often attended by tens of thousands of people and high-ranking civilian and military officials.

Polls indicate the military is among the most respected institutions in Turkey, even though approval rates have slipped. Almost 16,000 members of the military, from generals to privates, were investigated for suspected involvement in the movement of the US-based Islamic cleric Fethullah Gulen, a former ally of the president who is blamed by the government for a coup attempt against Erdogan in 2016. Approximately 44% of generals in the land forces have been suspended or arrested, the Posta daily reported.

Erdemir said the coup has dented the military’s popularity. Citing the European Commission’s Eurobarometer surveys, he said: “Turkish citizens’ trust in the military hit the lowest in a decade, 62%, in November 2016, shortly after the abortive coup.”

Since then, the army’s reputation has recovered somewhat. Operation Euphrates Shield, Turkey’s cross-border operation into northern Syria in 2016, helped the army’s approval rating, Erdemir wrote. “The recent Turkish operation in Afrin will likely result in a similar uplifting effect.”