"They searched us and took our phones before escorting us to the area where the makeshift hanging stage was built," a relative of the victim said. "They brought him in surrounded by security. He talked to the sheik before they took him for the hanging. After a few minutes, a doctor confirmed his death."
The relative said it was difficult watching someone lose his life. "Then I told myself its divine justice. God is avenging the victims."
Both witnesses spoke on condition of anonymity because Hamas ordered those in attendance not to talk to the media.
Human rights groups had called on Hamas to halt all executions, saying Gaza's justice system is badly tainted, including by forced confessions.
Gaza's attorney general, Ismail Jaber, said the law was respected throughout Abu Aliyan's case, including an appeal. He said the executions were not meant to become public spectacles like the stonings and beheadings that are common in countries like Iran and Saudi Arabia.
Abu Aliyan was convicted of two killings, including sexually assaulting and bludgeoning to death a boy when he himself was only 14.
The case against Abu Aliyan began in 2009, when he turned himself in to police after allegedly stabbing to death an acquaintance during a financial dispute. His lawyer had claimed Abu Aliyan was abused during interrogation and confessed to the earlier killing after being tortured.
Executions have aroused little public opposition in conservative Gaza, where tribal customs and Islamic religious law, or Shariah, call for putting to death convicted killers.
Hamas seized Gaza in 2007 and has firmly entrenched its hold on the territory, home to about 1.7 million people. The Hamas-run justice system and past executions have been criticized by human rights groups.
According to an Associated Press count, it was the 30th death sentence carried out by Palestinian authorities since 1994. Of those, 28 took place in the Gaza Strip.
The rival Western-backed Palestinian government in the West Bank has not carried out the death penalty since President Mahmoud Abbas took office in 2005.