"Rather than facing our people with our heads down tomorrow, we prefer to stand tall today against the scum at home and abroad," he told thousands of rapturous supporters who gathered for an AKP congress, where he is the only leadership candidate.
"We will continue our battle against all terrorist organisations," he said in the Ankara sports arena, vowing to maintain a state of emergency in Turkey until peace is achieved in Turkey's fight against Kurdish and Islamist militants.
Erdogan, who founded the Islamist-rooted AKP in 2001 and led it to victory in an election a year later, was forced to surrender leadership nearly three years ago when he was elected president, a position traditionally above party politics.
That changed with last month's referendum, in which Turks narrowly backed a constitutional change to create an executive presidential system that will give Erdogan sweeping new powers and allow the head of state to be a party member or leader.
He will be the first president to lead a party since Ismet Inonu, who succeeded modern Turkey's founder, Mustafa Kemal Ataturk, and was head of state until 1950. In a vote later on Sunday, he will replace Binali Yildirim, who is set to remain as prime minister until elections in 2019.
Such sweeping political changes, Erdogan says, are vital to ensure stability in Turkey in the face of militant threats and after an attempted coup last year that Ankara attributed to supporters of U.S.-based cleric Fethullah Gulen.
On the eve of Sunday's AKP congress Turkish police killed two suspected Islamic State militants in a clash during a raid on an apartment in Ankara, state-run Anadolu news agency reported. The two men killed were believed to be planning an attack, the agency said.
Opposition parties, which want the referendum annulled because of alleged irregularities, say the reforms push Turkey towards one-man rule. Some of Turkey's NATO allies and the European Union, which it aspires to join, have also expressed concern.
Erdogan's return to the party coincides with growing foreign policy challenges and tensions with NATO allies.
Last week he held talks with U.S. President Donald Trump in Washington, where he sought to reconcile deep disagreement over U.S. support for a Syrian Kurdish militia, which Ankara regards as a terrorist group.
There was also a deterioration in ties with European Union countries in the build-up to the referendum. Tensions with Germany have been exacerbated by a dispute over the stationing of German troops at Turkey's Incirlik air base.
In one of his first steps after taking over the party, Erdogan is expected to streamline his economic team to try to speed up decisions and reassure markets that ministers are working to the same plan, sources said.
Once regarded as one of the world's most promising emerging markets, Turkey has been hit by a sell-off of the lira on concerns about the erosion of institutions and the slow implementation of promised change.
Erdogan rejoined the AKP this month in what was the first of 18 constitutional amendments to be implemented. In a second step, lawmakers elected seven members to a reshaped judicial authority on Wednesday.
The other amendments, giving the president authority to draft the budget, declare a state of emergency and issue decrees, will not take effect until after elections scheduled for November 2019.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)