The government had sent out inspectors to keep prices down at the wholesale markets, he said.

When the inspectors encountered a hostile reception from the wholesalers, Mr. Erdogan compared their attackers to terrorists.

“They attempted to beat up our inspectors. Why? Because they kicked the hornet’s nest,” he said.

“If there are those who think they are stronger than the state, they should know that we will finish those who terrorized the wholesale market as soon as possible, as the state finished the terrorists in Cudi, in Gabar, in Tendurek, inside the caves,” he said, in a reference to Turkey’s counterterrorism operations against Kurdish insurgents in southeastern Turkey.

“Can we allow our nation to be exploited? We will join hands and God willing will finish this exploitation,” he said.

Mr. Erdogan, who won elections last year to a newly powerful presidency, is personally secure. No Turkish politician comes close to matching his popularity.

But the municipalities are the base of A.K.P.’s support and are critical to its hold on power and its reputation for being able to provide services, mainly for the urban working class and conservative communities.

There, at the local level, indicators show its support to be slipping. The party failed to win a majority in parliamentary elections last year, forcing it to go into a coalition with the Nationalist Movement Party, and it faces a similar test in local elections March 21.