Image copyright EPA Image caption The rapes, which happened near Kabul in August, caused outrage

Five Afghan men convicted of gang-raping four women have been executed in a case that sparked national outrage.

Officials say the men were hanged at Pul-e-Charkhi prison east of Kabul. A sixth man convicted of unrelated crimes was also hanged.

The authorities ignored last-minute appeals for clemency from rights groups who said the convictions were unsafe.

Violence against women in Afghanistan is rife but correspondents say cases rarely attract this much attention.

Many Afghans had demanded the death penalty. Correspondents say that given public opinion, there was little chance of the sentences not being carried out.

Image copyright AP Image caption There was tight security outside Kabul's main prison

"The court's verdict has been implemented and all the convicts have been executed - five from the Paghman case, plus Habib Istalifi, who was head of a notorious kidnapping gang," the attorney general's chief-of-staff Atta Mohammad Noori told AFP news agency.

Former President Hamid Karzai signed the death warrants on his last day in office. There was no word from new President Ashraf Ghani, who took over in September.

The 23 August rapes took place at night at a popular picnic spot in Paghman district near Kabul as the women were returning to the capital with their families from a wedding.

The attackers - armed and some dressed in police uniforms - tied up the men in the group and dragged the women from their cars before raping them.

There was a chorus of outrage. Many campaigners in Afghanistan - where women who are raped sometimes find themselves accused of adultery and punished - even wanted the executions to go ahead, correspondents say.

Image copyright EPA Image caption One of the women who was raped is seen here giving evidence in court

But critics say the legal process was rushed - the televised trial took only two hours. One defendant said he had been tortured into confessing.

The UN's High Commissioner for Human Rights expressed "grave concerns" that hanging the men would not deliver justice to them or their victims. International human rights groups also criticised Mr Karzai for calling for the men to be hanged even before they were tried.

Amnesty International called the hangings an "affront to justice".

The five were originally sentenced to death for armed robbery along with two other men. The other two, who were not convicted of rape, later had their death sentences commuted to life in prison.

In a separate case, police said they had been pursuing Habib Istalifi, the sixth man to be hanged for crimes unconnected to the gang rape, for the past 10 years.

"He was head of a major crime gang involved in several cases of kidnapping and armed robbery," Hashmat Stanekzai, a Kabul police spokesman, told the BBC. "He was involved in several murders of vehicle drivers."

Capital punishment is relatively rare in Afghanistan.

Since the Taliban were ousted in 2001, hundreds of people have been sentenced to death but Mr Karzai signed warrants for the execution of just 30, BBC correspondents say.