MOSCOW -- Something funny happened the day before Azerbaijan's presidential election: The election commission announced the winner.
On Tuesday, the smartphone app of the Central Election Commission released the results of Wednesday's vote, showing President Ilham Aliyev, whose family has been at the helm of this oil-rich Caspian Sea nation for four decades, winning 73 percent of the vote.
The commission explained the gaffe by saying that a software developer had released the figures as a "test" at one polling station. It apologized for the "misunderstanding."
Official results on Thursday showed Aliyev winning nearly 85 percent of the vote. His closest challenger, main opposition candidate Jamil Hasanli, trailed with less than 6 percent, followed by eight fringe candidates, according to the commission.
Monitors from the Organization for Security and Cooperation in Europe called the vote flawed, noting the disproportionate coverage of the president, the limitations on the freedoms of expression and assembly, ballot box stuffing and poor vote counting practices. Hasanli has demanded a new vote.
Aliyev's victory follows years of what rights groups describe as a relentless campaign to harass government critics. It also reflects his popularity, which has been buoyed by oil riches that have more than tripled Azerbaijan's economy and filtered down even to its poorest citizens.
A look at Aliyev's rule and the country's presidential election:
A LONG-ENTRENCHED DYNASTY
Aliyev has been at the helm since 2003, succeeding his father, Geidar Aliyev, who ruled Azerbaijan for most of the previous three decades, first as the Soviet-era Communist Party boss and then as its post-Soviet president.
Aliyev has postured as a guarantor of stability, an image that strikes a chord in Azerbaijan, where memories of chaotic years around the 1991 Soviet collapse are still fresh. Soon after the senior Aliyev lost his post in a reshuffling by Soviet leader Mikhail Gorbachev, Azerbaijan plunged into a war with neighboring Armenia over the disputed territory of Nagorno-Karabakh that led to humiliating territorial losses and turned 1 million people into refugees.
Aliyev senior made a triumphant comeback in 1993 and engineered the transfer of power to his son just before his death. International observers have strongly criticized that 2003 election and subsequent votes.
AN OIL-DRIVEN PROSPERITY
Booming oil prices have tripled Azerbaijan's economy during the younger Aliyev's decade in power. The State Oil Fund held $34 billion at the start of the year. The flow of petrodollars has transformed the once-gritty capital of Baku, on the Caspian Sea, into a glimmering mosaic of futuristic buildings. With much pomp, Azerbaijan hosted the 2012 Eurovision contest at the new 25,000-seat Crystal Hall.
A WESTERN ALLY
Aliyev has firmly allied Azerbaijan with the West, helping the United States and the European Union protect their energy and security interests in the strategic Caspian Sea region. BP, ExxonMobil and other Western oil giants have invested billions to tap Azerbaijan's oil riches. In 2005, an oil pipeline started pumping Azerbaijani crude to Turkey, bypassing Russia, reducing Europe's dependence on Russian energy resources. Azerbaijan has also contributed troops to the U.S.-led missions in Kosovo, Afghanistan and Iraq and became a key conduit for U.S. supplies to its forces in Afghanistan.
Transparency International, a global anti-corruption watchdog, says Azerbaijan is plagued by endemic corruption that hampers its development and prevents the population from sharing in the country's oil wealth. It ranked Azerbaijan 143 out of 183 countries in its 2011 Corruption Perceptions Index.
A POOR HUMAN RIGHTS RECORD
International rights groups have criticized the Azerbaijani government for stifling dissent and intimidating its opponents. They say dozens of activists have recently been arrested and imprisoned on bogus charges and police have routinely dispersed street protests. Human Rights Watch said the crackdown specifically targeted youth groups after the Arab Spring uprisings.
A BESIEGED OPPOSITION
Years of relentless government crackdowns and bitter infighting have weakened the opposition, which found it hard to mount a challenge to Aliyev in the latest vote. Election officials refused to register its candidate because he had Russian citizenship -- something explicitly banned by the law. Hasanli, a history professor who stepped in as the main opposition candidate, tried to focus on official corruption and social inequality but many observers said his campaign was poorly planned and lacked energy.
A CONTROVERSIAL VOTE
OSEC monitors blasted Wednesday's election, saying it lacked a "level playing field for candidates." It cited detentions, criminal prosecutions, reports of physical attacks and other pressure on journalists as well as disproportionate media coverage of the president. It reported ballot-box stuffing in 37 polling stations and called the vote counting practices "overwhelmingly negative."