Former president defeated by Hollande in 2012 expected to run as candidate to lead centre-right UMP in runup to 2017 poll

The former French leader Nicolas Sarkozy, the man who vowed he would never be heard of again after losing the 2012 presidential election, announced his political comeback on Friday.

After months of feverish speculation, the former president declared he would return to public life and seek election as head of the opposition UMP party.

In a long post on his Facebook page, which has more than 1 million followers, he wrote: "I am candidate to the presidency of my political family."

Just as it was an open secret that Sarkozy had no intention of remaining out of the political limelight, few are in any doubt that if he wins the UMP leadership vote, he will use the position as a springboard to stand against François Hollande in 2017.

In his message, which began "Dear friends", Sarkozy said his time out of power had given him the opportunity to "reflect, after all those years of intense activity" and to "take the necessary step back to analyse the years of my term in office, to learn the lessons … to examine the vanity of certain feelings, and to put aside any feelings of revenge or confrontation."

He had done this he said: "Without the weight of power that twists human interaction."

He added that he had taken a long, hard look at the "opportunity of a return to the political life that I left without bitterness and without regret.

"At the end of this period of deep reflection, I have decided to offer the French a new political choice."

The announcement put an end to the phoney will-he-won't-he speculation of the past two years. Before his defeat by Hollande in 2012, Sarkozy had said that if he lost "nobody will hear of me again". However, after leaving the Elysée and keeping silent for three months, Sarkozy began hinting that he was not giving up politics for good.

Since then, the former president has sent regular updates – nicknamed "postcards" – to the French in the form of photo opportunities showing him and wife Carla Bruni-Sarkozy leading a happy family life outside politics, and reports of his "new" career as a highly paid keynote speaker around the world. Behind the scenes, he has been meeting heads of state in a private capacity to maintain his contacts.

He is, however, still at the centre of a number of legal investigations. The French election auditors rejected his 2012 campaign accounts and ordered him to repay €363,600 (£286,200), which was raised through a donation campaign by UMP party members.

In April last year, a judicial investigation was launched over claims that former Libyan dictator Muammar Gaddafi helped fund Sarkozy's successful 2007 presidential campaign. In July, Sarkozy was detained for questioning by police over allegations of abuse of power.

After the unprecedented step was taken, Sarkozy went on television to complain he was the victim of political score-settling and described the accusations as "grotesque". He was put under official investigation in the summer over an investigation into UMP party funding.

The UMP, riven with internal squabbling since Sarkozy's election defeat two and a half years ago, will vote on a new leader at the end of November, giving the former president two months to campaign.

His rivals are expected to be former prime ministers Alain Juppé and François Fillon, former employment minister Xavier Bertrand and some of the party's younger guard.

French political analysts predicted Sarkozy would "officialise" his return in three stages: with an initial announcement on Facebook, followed by a series of articles in the regional press and finally a television appearance.

Brice Hortefeux, one of Sarkozy's closest friends and advisers, told Europe 1 radio: "His biggest preoccupation today is the state of the country and what our compatriots are going through."

At his biannual press conference on Thursday, Hollande did not name Sarkozy but said: "Those who have governed yesterday and before yesterday have a perfect right to seek to govern tomorrow and after tomorrow. That's democracy."

Fillon has been less rapturous about Sarkozy's eventual return, suggesting it was time for new blood to lead the UMP. "It would be good for a new generation to take responsibility … to lead our movement and overcome the financial and legal challenges."

Pascal Perrineau, director of the Sciences Po thinktank Cevipof, said Sarkozy would have to change his behaviour if he returned. "And that's where the difficulty might be," Perrineau told Les Echos newspaper. "I think it's difficult to change personality. The Sarkozy of 2012 lost. He lost, but at the time he didn't wanted to go back and examine his defeat and neither did his party. It will not be an easy exercise for him to go back and ask why didn't it work then."

Reactions to the news of Sarkozy's comeback were mixed. Christian Estrosi, the mayor of Nice who is also an MP representing the UMP and a close friend of Sarkozy, tweeted: "Nicolas Sarkozy has chosen duty. By his side let us give new hope for France."

However, François de Rugy, head of the Ecology Party in the National Assemblée, wrote: "Nicolas Sarkozy is not returning to save France … he ruined it. He's not returning to save the UMP … he ruined it. If he is reinventing himself as the head of the UMP would it be to save his legal skin?"

A recent poll by Ifop for Paris Match suggested Alain Juppé was popular with 66% of French voters, compared with 43% for Nicolas Sarkozy, but put the two men on a more equal footing among UMP supporters, suggesting the party primaries in November will be a close-run race.

In L'Express magazine, editor Christophe Barbier wrote: "If he were alive today, the Count of Monte-Cristo would be ahead in the polls. The French like stories of comebacks, of defying fate and stories of revenge. They like the opinionated, the resilient, those who cannot be beaten."