ANKARA: Despite allegations of corruption and concerns about authoritarianism, Turkey’s local elections have given Prime Minister Recep Tayyip Erdogan momentum for a campaign to become the country’s first directly elected president.

Erdogan’s ruling Justice and Development party swept municipal elections on Sunday, gaining 45.5 percent of the votes and roundly beating the main opposition party, according to unofficial results. Erdogan’s party retained the key city of Istanbul and was leading in a close race in Ankara, where the results were likely to be contested.

Turkey’s stock market rallied Monday, as Erdogan’s win eased market concerns over instability. The Turkish lira strengthened against the dollar and the euro.

Analysts say the result amounts to a vote of confidence for Erdogan and will encourage him to run in presidential elections in August, where he would have to win 50 percent of the votes.

“Erdogan has seen that he has the support of a mass of people that believes in him and won’t desert him under any condition,” wrote Mehmet Tezkan, a commentator for Milliyet newspaper.

Erdogan’s presidential aspirations had been put in doubt after last year’s anti-government protests, a corruption scandal and a series of restrictions on freedom, including blocking access to Twitter and YouTube. The curbs on social media came after several audio recordings were leaked, suggesting corruption by Erdogan and family members.

Kemal Kilicdaroglu, the main opposition party leader, said Monday the election results would embolden Erdogan to further restrict freedoms and democratic rights.

He said Erdogan should answer the allegations of graft in court before seeking the presidency.

“A man with a questionable reputation cannot be president,” Kilicdaroglu said.

Erdogan and his party have dominated Turkish politics in a decade of great prosperity. The party came to power backed by a pious Muslim base looking for greater standing in a country that had for decades favored a secular elite.

The allegations of corruption and bribe-taking have already brought down four ministers. Erdogan claims the allegations are a plot orchestrated by followers of his former ally, US-based Muslim cleric Fethullah Gulen. Following the results, Erdogan promised retribution against Gulen’s movement.

Sunday’s resounding victory of Erdogan is likely to put already cool relations between Ankara and Brussels in the chiller. Experts say Turkey finds itself at sharp odds with the European Union, which it has been negotiating to join since 1999.