The European Union has welcomed the decision by an Azerbaijani court to release opposition politician Ilqar Mammadov after more than five years in prison.

"The European Union has been following Mammadov's case very closely together with the Council of Europe," said a statement by Maja Kocijancic, spokeswoman for EU foreign-policy chief Federica Mogherini.

Mammadov, the leader of the opposition Republican Alternative (REAL) party, was released from prison on August 13 after serving more than five years of his seven-year term.

"The European Union expects the unconditional release and rehabilitation of all those currently imprisoned or under restriction of movement in Azerbaijan on political grounds in line with Azerbaijan's international commitments as a member of the United Nations, the Council of Europe, and the Organization for Security and Cooperation in Europe," Kocijancic said on August 14.

A court of appeals in the northern city of Saki ruled on August 13 that Mammadov's remaining prison term must be suspended.

The court also ruled that Mammadov be given a two-year probation period during which he will not be allowed to leave the country.

Mammadov called the ruling "not a complete victory," saying that that he and his lawyers had demanded "a full acquittal."

Mammadov was arrested in February 2013 and charged with helping organize riots in the town of Ismayilli, northwest of Baku. He was sentenced to seven years in prison in March 2014.

The opposition leader has insisted that the case against him was politically motivated.

In April, the REAL opposition movement announced it was now a political party but said it would not seek formal registration by the state.

Rights groups and Western governments have urged the Azerbaijani authorities to release Mammadov and other political prisoners in the oil-rich South Caucasus country for years, and criticized the former Soviet republic's government for persistent clampdowns targeting independent journalists and rights defenders.

President Ilham Aliyev, who has ruled the Caucasus nation of almost 10 million people with an iron fist since shortly before his father's death in 2003, has shrugged off the criticism.

With reporting by RFE/RL's Azerbaijani Service