ISTANBUL — Even before the important election of Istanbul’s mayor has been settled, the opposition candidate, who claims to have won, is challenging President Recep Tayyip Erdogan by pressing ahead with his promise to have an independent audit of the city’s books.

Mr. Erdogan and his party have been in control of the city since 2002, and analysts and opponents say they have warped the economy through kickbacks and crony schemes. There has not, however, been real proof of this.

Now, Mr. Erdogan’s party is demanding a recount of the vote. The opposition candidate, Ekrem Imamoglu, says this is a delaying tactic. And, at a news briefing on Wednesday, he said the party was trying to erase town hall records from computers before he takes over and brings in independent auditors to examine the city’s books.

His promise of an audit dramatically raises the stakes for Mr. Erdogan, who was confronted with a stunning electoral defeat Sunday night, when his Justice and Development Party, or AKP, was shown to be losing the contests for mayor in both Ankara and Istanbul.