Gaza City - The public execution of alleged Palestinian informants for Israel in the Gaza Strip, known locally as collaborators, drew international attention recently, a few days before the end of Israel's seven-week military offensive in the coastal territory.

With beige sacks over their heads, several men were positioned on their knees in front of a white wall. Standing over them, their executioners: armed Palestinian fighters, dressed in all-black, balaclavas over their faces and AK-47s strapped to their sides.

At least 18 Palestinians were executed on August 22 in Gaza, accused of providing information to Israel during its recent war. But what exactly motivates a Palestinian to collaborate with the Israeli intelligence services, and how does the phenomenon work?

"Under pressure, I gave into [their] demand," said a former Palestinian collaborator, who spoke to Al Jazeera on condition of anonymity. A resident of the Gaza Strip, the man said that an Israeli intelligence officer approached him in 1995, threatening to revoke his permit to work in Israel if he didn't divulge information about the location and activities of Hamas members, among others.

Under pressure, I gave into [their] demand... I was unhappy and couldn't live [with] that shame, so one day I woke up and told my wife I would no longer work in Israel. - Former Gaza-based collaborator with Israel

"I was unhappy and couldn't live [with] that shame, so one day I woke up and told my wife I would no longer work in Israel," the man recalled. He immediately went to the Palestinian security forces to confess what he had done. Imprisoned for a few weeks, he was eventually released on voluntary probation.

RELATED: Hamas executes 18 suspected informers

For years, Israel has relied on Palestinians to gather information. Often, Israeli officials threaten peoples' families or livelihoods, or offer incentives, such as difficult-to-secure travel permits or cash, in order to get people to collaborate.

Capital punishment is permissible under the Palestine Liberation Organisation's Revolutionary Penal Code of 1979, including Article 9, which stipulates that a person can receive the death penalty for acting "against the security and safety and interests of the revolution troops".

Human Rights Watch reported in 2012 that "given credible evidence of widespread and gross violations of due process as well as systematic ill-treatment and torture… Hamas should immediately declare a moratorium on executions in death penalty cases".

According to political researcher Hazem Abu Shanab, several of the men who were recently executed in Gaza had spent about one month in prison, where they confessed during interrogation to giving information to the Israelis or planting surveillance equipment in Gaza.

"One of the methods of recruiting collaborators is by shutting down Rafah crossing [between Gaza and Egypt] and allowing Palestinians to travel through Erez [crossing between Gaza and Israel], so that it can pressure, blackmail and tempt them to work as collaborators," Abu Shanab said.

Shawan Jabareen, director of Palestinian human rights group Al-Haq, said that the men executed in Gaza likely did not have a fair trial, a guarantee under the Fourth Geneva Convention, and called on Palestinian factions to halt the practise of executing collaborators.

He added that sometimes, Palestinians' humanitarian needs are abused in order to coerce them into providing information. "Those peoples' needs and illness have been abused and the [Israeli authorities] force them to work in its military and security apparatuses. [Israel] is responsible for the crime," Jabareen said.

INTERACTIVE: Gaza, life under siege

Collaborating with an occupying power has long been considered a shameful act in many places around the world. In tight-knit communities across Palestine, families and extended relatives of collaborators are often shunned. "In Egypt and Syria collaborators with Israel have been also associated with shame," said Dr Nehad El-Sheikh Khalil, a historian and professor at Gaza's Islamic University.

Mohammed Abu Hassira, 30, told Al Jazeera that social media has become a place where Israeli intelligence officials seek out collaborators from Gaza. With an unemployment rate of 40 percent in Gaza - the highest since 2009 - offers of money and other perks are tempting, Abu Hassira said. "Many are innocent, naive youngsters who don't know they are collaborating," he added.

Indeed, according to Gaza security services interrogator Abu Ahmed, who didn't give Al Jazeera his full name, the information requested often appears inconspicuous.

"One of my collaborators was asked for simple information: look from the balcony and see what types of clothes are hanging there," he told Al Jazeera. "The request appears very innocent, but in that case, it was an apartment of a Hamas leader and Israeli intelligence wanted to know if men's clothes were drying on the balcony, indicating that the occupant was asleep inside."

In other cases, Gaza security officials have caught merchants asked to bring small bags of sands to the Erez border crossing with Israel. "It turned out he [was taking] this sand to be tested by Israeli intelligence officials… to figure out location of [Palestinian] tunnels."

RELATED: Palestinian rappers 'teach life' in Gaza

While most Palestinians in Gaza backed the recent executions, many were uneasy with the way they were carried out.

"Last week's executions are the least of what should happen to control the movement of collaborators," said Abu Hassira, adding, however, that he would have preferred that a government body execute the men, rather than masked gunmen. "Any armed masked men could come, and pretend they are killing collaborators, while it could be family revenge or anything," he said.

Collaborators are national traitors and the only solution for them is the execution. [But] those people should be given a fair trial and should have the right to defend themselves. - Fatih Sabbah, Gaza-based journalist

Local journalist Fathi Sabbah agreed. "Collaborators are national traitors and the only solution for them is the execution," he told Al Jazeera. "[But] those people should be given a fair trial and should have the right to defend themselves."

"We demand that the Palestinian National Authority and the [Palestinian armed factions] intervene to stop these extra-judicial executions, no matter what the reasons and motives are," said Raji Sourani, head of the Gaza-based Palestinian Center for Human Rights, in a statement.

But the practise doesn't seem to be stopping, as Palestinian factions in Gaza announced that 13 more collaborators had handed themselves in to the local security services.

"Palestinian resistance groups should be fair and comply with laws," said a Gaza judge, who works on collaborators' cases and who spoke to Al Jazeera on condition of anonymity. "It's enough that Israel kills scores of us on a daily basis."

Follow Mohammed Omer on Twitter: @mogaza