ANKARA, Turkey — A former prime minister and erstwhile ally of President Recep Tayyip Erdogan said on Friday that he was creating a new political party, a challenge that could splinter the governing party and fatally damage the Turkish leader’s chances for re-election.

Ahmet Davutoglu, once Mr. Erdogan’s closest ally, served under him as foreign minister and then prime minister until 2016. His break with the Turkish president represents a direct challenge as Mr. Davutoglu pledges a return to the original principles and ideals of their old party.

To the cheers and whistles of a large crowd of supporters in a hotel ballroom in Ankara, the capital, Mr. Davutoglu unveiled his Future Party, saying that “the future is our nation’s, the future is Turkey’s.”