Former French president Nicolas Sarkozy has been elected head of the French opposition UMP party, two months after announcing his political comeback.

The one-time French leader obtained 64.5 per cent of votes from party members in a record turnout.

The result means Sarkozy takes control of the UMP immediately and will not have to submit to a second round vote next weekend.

The victory was the first major step in Sarkozy’s plan to make a second presidential bid in 2017.

It came almost exactly ten years after Sarkozy was first elected leader of the UMP in November 2004. He went on to win the 2007 presidential election.

Opinion polls had predicted Sarkozy’s win – though his closest rival, former agriculture minister Bruno Le Maire had closed the gap in the run up to the vote – but it was vital he gain a clear majority.

The score was a clear majority, but lower than Sarkozy had hoped in order to definitively see off rivals in his own party, including former prime ministers Alain Juppé and François Fillon, to be nominated the UMP presidential candidate in 2017.

The third candidate Hervé Mariton had 6.3% of votes.

Analysts said the victory was “mediocre” for Sarkozy, and an “unexpected surprise” for Le Maire.

Former prime minister Alain Juppé, expected to be Sarkozy’s rival in 2017, said: “I am happy the elections went well. It was a clean win (for Sarkozy). I’m obviously pleased pleased the UMP can now close the scars of the previous (leadership) election”.

Analysts pointed out it was the first time Nicolas Sarkozy had faced opposition within his own party.

On his Facebook account, Sarkozy wrote: “Dear friends, I’d liked to thank all the UMP party members who had done me the honour of electing me to lead our political family. Their turnout, unprecedented in the history of our movement, is the best response to two years of internal quarrels and divisions. This campaign has been dignified. I salute, in the name of all party members, Bruno Le Maire and Hervé Mariton who took part in this debate with conviction and respect.”

He added: “Now the time has come for action.”

Party chiefs hope it will mark a new start for the UMP, which was riven with damaging internecine fighting after Sarkozy lost the 2012 presidential election, after just five years in office, to Socialist François Hollande.

A leadership vote in September 2012 imploded into allegations of vote rigging and fraud, and ended with the installing of a temporary “collegiate” team to run the party.

The UMP is also mired in a corruption inquiry over allegations that false bills were used to hide the true cost of Sarkozy’s 2012 campaign.

Nathalie Kosciusko-Morizet, a former UMP minister in Sarkozy’s government, described the election as “a renaissance” for the party.

Sarkozy is also officially under investigation as part of a corruption and misuse of power inquiry.

The party’s 268,300 paid-up members were eligible to take part in the electronic vote that ran for 24 hours from Friday evening and party officials hailed a record 58.1% participation.

Shortly after the poll opened, UMP election officials said the party’s computer system had been subject to “an external attack” that had temporarily disrupted the vote. The cyber attack involved simulating thousands of connections to overload the voting site and force it to crash. A police inquiry is underway.

“Several pirating attempts that were, according to the experts, clearly organised have been made. This isn’t down to amateurs, it’s serious,” Luc Chatel, UMP general secretary told France Info radio.

He added: “We know we were going to be attacked; the UMP site has been attacked several times in the last few days.”

Hervé Mariton, one of the three candidates, claimed party members were having difficulty connecting to the vote website.

Sarkozy was said to have learned of the result at the luxury home belonging to his wife, former supermodel, Carla Bruni-Sarkozy, according to his entourage. Earlier he had attended a football match at the Paris-Saint Germain ground at Parc des Princes.

“We haven’t arranged anything special. Sobriety and humility are the order of the day. The idea is to keep a low profile and enjoy a quiet victory so as not to give the impression we’ve captured the castle,” said a member of the former president’s election team.

Sarkozy has promised to transform the UMP from “top to bottom”, and create a wave of centre-right unity behind him. However, his campaign, which occasionally lurched into the far-right Front National’s territory, was seen as divisive.

One of his first moves will be to change the party name. The Union pour Un Mouvement Populaire, started life as the Union Pour La Majorité Présidentielle to support Jacques Chirac’s 2002 presidential reelction bid.

At the UMP headquarters in Paris’ 15th arrondissement on Saturday evening, the acronym UMP was nowhere in sight.

Sarkozy will also need to urgently address the party’s parlous finances; it is currently estimated to be €74m in debt. Sarkozy has ruled out sacking any of the UMP’s staff of 85, but says he will attract new members to plug the financial hole.

In 2012 Sarkozy told journalists he would quit political life if he was defeated in the presidential election.

Announcing his change of heart and return to the political fray in September, Sarkozy told French television it was his duty to make a comeback: “It’s not about what I want, it’s that I don’t have the choice.”