Last year, Erdogan narrowly won a referendum to convert the country's parliamentary system to a powerful executive presidency.
Turkey is gearing up for early presidential and parliamentary elections.
When President Recep Tayyip Erdogan called early elections two months ago, he seemed assured of victory.
But in a situation labelled as blatant unfairness by activists, the HDP's presidential candidate Selahattin Demirtas has campaigned from a prison cell after his November 2016 arrest on charges of links to outlawed Kurdish militants.
CNN reports that Erdogan declared himself the victor before the results were announced, leading to opposition claims that "state media and the election commission had manipulated the results and saying it was too early to be sure of the outcome".
But he reckoned without Muharrem Ince, the presidential candidate of the secularist Republican People's Party (CHP), whose feisty performance at campaign rallies has galvanized Turkey's long-demoralised and divided opposition. The current prime minister, Binali Yildirim, said he expects he'll be appointed vice president.
In the parliamentary contest, the AK Party had 43 percent and its MHP ally almost 11 percent, based on 90 percent of votes counted, broadcasters said. He said he had voted for the governing party over the past 16 years but complained angrily about the deteriorating economy.
His ruling Justice and Development Party, or AKP, is hoping to retain its majority in parliament.
In the parliamentary election, the president's AK Party (AKP) will face a tough battle to keep its majority in the 600-seat assembly.
The political opposition is disputing the official results, saying more votes have to be counted, and has accused the country's election commission of manipulating results. Polls suggest that the presidential vote could head into a second-round runoff on July 8 and that the Justice and Development (AK) Party could lose its parliamentary majority after 16 years.
Thousands of jubilant supporters of the pro-Kurdish Peoples' Democratic Party, or HDP, also spilled into the streets of the predominantly Kurdish southeastern city of Diyarbakir after unofficial results from Anadolu showed the party coming in third with 11.5 percent of the legislative vote - surpassing the 10 percent threshold needed to enter parliament. Under the system, the office of the prime minister is eliminated and executive powers are transferred to the president, who can rule with only limited checks and balances. The constitution also decreases Parliament's power, among other measures. Critics say it is a blatant power grab and pushes Turkey closer to authoritarian rule.
But critics claim that the coup attempt also been used to silence dissident voices in the country, as many acedemics, opposition politicians and journalists have also beeen detained in its aftermath.
Turkey's military operations, created to guard its borders, are not the only way to ensure security as peaceful settlement of regional conflicts also proves to be effective, Unal Cevikoz, the Turkish opposition Republican People's Party (CHP) deputy chair responsible for public diplomacy, told Sputnik on Sunday.