As thousands of people joined the march, government officials, unnerved by the spectacle, likened the participants to terrorists.

 In April, when Erdogan called for early elections, he framed them as necessary to make Turkey’s government “stronger and more effective” at a time when the country’s military was fighting against Kurdish groups across its borders in Syria and Iraq. But he was also preoccupied with the economy and anxious to stage the election before it took a turn for the worse, analysts said.

 The economic news did worsen after the president voiced his unorthodox view that high interest rates cause inflation and suggested he would take greater control of monetary policy after the election, sending the Turkish lira plummeting to record lows.

 The currency has slightly recovered, but the economy’s problems ran far deeper, said Atilla Yesilada, an analyst with the Istanbul-based Global Source Partners. “Years of irresponsible policies have overheated the Turkish economy. High inflation rates and current account deficits are going to prove sticky,” he said. “I think we are at the end of our rope.”

Sensing an opening, Turkey’s often divided opposition parties have started to come together. Four parties, including the CHP, the nationalist Good Party and the Islamist Felicity Party formed a coalition to compete in the parliamentary elections, broadening their ideological appeal. The pro-Kurdish Peoples’ Democratic Party, or HDP, did not join the coalition. But Ince, the CHP candidate, visited Demirtas in prison and has recently reached out to Turkey’s Kurds, a critical voting bloc, during his campaign rallies.

 The coalition is “a big deal” and a possible counterweight to Erdogan’s own alliance with another nationalist party, said Omer Taspinar, a Turkey expert at the Brookings Institution. “If the opposition can maintain some sense of unity they will improve their chances.” They also stood to benefit from the “worsening economy, and the emergence of a charismatic, center left-wing leader,” he said, referring to Ince.

 There were also signs of fatigue among AKP voters, to the apparent frustration of Erdogan, “who blamed them for not being active enough,” he said.

 But the opposition has not presented a broader plan for Turkey and its future that would rival Erdogan’s grand vision for transforming the country into an economic powerhouse by 2023, a vision punctuated by plans for megaprojects and sprinkled with nationalist rhetoric.

 “The opposition’s main message is, enough is enough. You have been in power too long, you represent the past. Maybe that would work if he was 80 years old,” Taspinar said. “Erdogan is still a force to reckon with, despite his vulnerabilities. He has done well for the middle class.”

Armagan, the AKP official, said that as he had campaigned for the party’s candidates in recent weeks, voters he encountered “see a lack of vision,” from the opposition.   “Maybe Muharrem Ince made a lot of noise and took some attention,” he said, but added: “You should tell people how you will take this country further.”