BAKU, Azerbaijan -- BAKU, Azerbaijan (AP) — Something funny happened the day before Azerbaijan's presidential election: The election commission announced the winner.

On Tuesday, a day before the voting began, the smartphone app of the Central Election Commission released results showing President Ilham Aliyev, whose family has been at the helm of the Caspian Sea nation for four decades, winning 73 percent of the vote.

After the polls closed on Wednesday, the commission said Aliyev had won 85 percent of the vote. His closest contender, Jamil Hasanli, trailed with less than 6 percent, it said.

The commission apologized for the early result, saying Thursday it had been only a test at one polling station conducted by the software developer. It expressed "deep regret" for the "misunderstanding."

Hasanli called the vote rigged and demanded a new election.

"Ilham Aliyev has no right to represent the Azerbaijani people," he said. "This election doesn't reflect the people's will."

Observers from the Organization for Security and Cooperation in Europe said Thursday the election was marred by restrictions during the campaign and serious violations during the voting and during the counting of votes.

The vote "was undermined by limitations on the freedoms of expression, assembly and association that didn't guarantee a level playing field for candidates," the group said.

It cited detentions, criminal prosecutions, reports of physical attacks and other pressure on journalists as well as disproportionate media coverage of the president.

On voting day, the OSCE said its monitors reported ballot-box stuffing in 37 polling stations. It also called the vote count "overwhelmingly negative, with 58 percent of the observed polling stations assessed as bad or very bad."

Also on HuffPost:

Loading Slideshow...
  • In this Monday, May 13, 2013 file photo Azerbaijani President Ilham Aliev talks with Austrian President Heinz Fischer, unseen, at the Hofburg palace in Vienna, Austria. (AP Photo/Ronald Zak, File)

  • AZerbaidjan's president Ilham Aliyev gives a press conference after a meeting with European Union commission president at the EU Commission headquarters in Brussels, on June 21, 2013. (THIERRY CHARLIER/AFP/Getty Images)

  • Austrian President Heinz Fischer (R) and President of Azerbaijan Ilham Aliyev address a press conference on May 13, 2013 in Vienna. (DIETER NAGL/AFP/Getty Images)

  • Montenegro President Filip Vujanovic (L) and his Azerbaijan counterpart Ilham Aliyev (R) review an honour guard upon his arrival at Podgorica airport on March 13, 2013. (SAVO PRELEVIC/AFP/Getty Images)

  • President of Azerbaijan Ilham Aliyev laughs during a discussion panel at the World Economic Forum 2013 annual meeting in the Swiss resort town of Davos, on January 23, 2013. (JOHANNES EISELE/AFP/Getty Images)

  • President of Azerbaidjan, Ilham Aliyev, is seen during the official opening ceremony of the new Department of Islamic Arts at the Louvre, on September 18, 2012 in Paris. (PIERRE VERDY/AFP/GettyImages)

  • Visiting Azerbaijani President Ilham Aliev takes part in a wreath laying ceremony at the landmark Victory Square in Minsk, on August 29, 2012. (VIKTOR DRACHEV/AFP/GettyImages)

  • European Commission President Jose Manuel Barroso, right, ushers President of Azerbaijan Ilham Aliyev, upon arrival at the European Commission headquarters in Brussels, Friday, June 21, 2013. (AP Photo/Yves Logghe)

  • President Ilham Aliyev of Azerbaijan and First Lady Mehriban Aliyeva arrives for a reception at Buckingham Palace for Heads of State and Government attending the Olympics Opening Ceremony at Buckingham Palace on July 27, 2012 in London, England. (Photo by Chris Jackson/Getty Images)

  • British Prime Minister David Cameron (R) meets the President of Azerbaijan Ilham Aliyev inside No.10 Downing Street on August 06, 2012 in London, England. (Photo by Facundo Arrizabalaga - Pool/Getty Images)

  • AZerbaidjan's president Ilham Aliyev gives a press conference after a meeting with European Union commission president at the EU Commission headquarters in Brussels, on June 21, 2013. (THIERRY CHARLIER/AFP/Getty Images)