ISTANBUL — Even before the Turkish authorities took the extraordinary step of undoing an opposition victory and calling a new election for mayor of Istanbul, the government had spent billions to prop up the country’s flagging currency over the last year and bolster its candidates.

But since last week, as the political turmoil rattles investors, it is spending sometimes a billion a day, even on the sly, to support the currency, the lira, as well as the waning aura of invincibility around President Recep Tayyip Erdogan.

Mr. Erdogan, 18 years in power, was re-elected last year for a new five-year term to a presidency with vastly expanded powers. He has already trimmed civil liberties, purged and jailed political opponents after a failed 2016 coup, and brought a free press to heel.

Increasingly, the president has also taken over management — critics say, mismanagement — of the economy to sustain the nearly unbroken growth that has brought him a loyal following.