Azerbaijani President Ilham Aliyev has announced pardons for 114 people, including more than 50 who were considered to be political prisoners.
President Aliyev agreed to European requests to free the prisoners
Seven opposition leaders are among those freed.
Europe's top human rights body, the Council of Europe, had demanded the release of political prisoners before elections due in November.
Opposition parties had complained of widespread fraud in Azerbaijan's 2003 presidential election.
The seven freed leaders had been convicted for taking part in mass protests at the time, and sentenced to prison terms of up to five years.
President Aliyev took over the presidency from his father after the vote, which was criticised by international observers.