ISTANBUL — The new mayor of Istanbul, Ekrem Imamoglu, has spent the last six months since his election combing over his city’s books to get a handle on how it had been run under his predecessor, an ally of President Recep Tayyip Erdogan.

On Monday, the mayor issued his verdict: a level of mismanagement and overspending that surpassed all expectations.

Things were so bad that the mayor even used a news conference to declare battle against one of Mr. Erdogan’s favorite projects, a $100 billion plan to cut a new shipping lane parallel to the Bosporus, announcing that the city was withdrawing from a protocol signed by his predecessor for what has been called Canal Istanbul.

The declaration was the mayor’s first real challenge to Mr. Erdogan and the powerful vested interests that have supported him since he took control of Turkey’s largest and wealthiest city, long the power base for the president and his governing party.