The suspected mastermind behind a deadly West Bank terror attack last month was among 1,027 Palestinian inmates freed by Israel in exchange for the release from Gaza of the captured Israel Defense Forces soldier Gilad Shalit in 2011.

On Sunday, the Shin Bet announced it had detained four members of a seven-member Hamas cell who allegedly opened fire on a car near the settlement of Shvut Rachel in June, killing Malachy Rosenfeld, 25, and wounding three others.

Rosenfeld was the sixth Israeli to be killed in attacks carried out or planned by Palestinians released under the Shalit deal since April 2014.

One of the alleged cell members, Ahmad Najjar, a Hamas operative who was said to have orchestrated and funded the shooting attack from Jordan, has yet to be apprehended, the security service said. Before being released in the Shalit prisoner exchange, Najjar spent eight years in an Israeli prison for his involvement in previous terror attacks that killed three Israelis.

Hamas’s terror network in the West Bank is largely operated by former security prisoners based in Gaza, Israeli media reported Monday.

The three kidnapped and murdered  teens, from left to right: Naftali Fraenkel, Gil-ad Shaar and Eyal Yifrach (photo credit: Courtesy)

The three kidnapped and murdered teens, from left to right: Naftali Fraenkel, Gil-ad Shaar and Eyal Yifrach (photo credit: Courtesy)

Under the terms of the 2011 swap, the majority of prisoners hailing from the West Bank were deported to Gaza, where they have been able to leverage their connections in the West Bank to facilitate attacks.

Prisoners released to the West Bank have also engaged in violent activity against Israelis, and the Palestinian Authority and Israeli security forces have rearrested dozens of them for rioting, hurling Molotov cocktails and funding terrorism.

Najjar’s arrest is a reminder of the cost Israel has paid for Shalit’s freedom, a scenario that critics of the deal predicted would unfold. Since 2014, six Israelis have been killed in terror attacks by Palestinian prisoners released under the Shalit prisoner exchange.

Undated habdout file picture released by the Israel Police of Baruch Mizrahi, 47, an inteligence service police high ranking officer, killed on April 14, 2014 near the West Bank city of Hebron (photo credit: AFP/HO/Israel Police)

Undated handout file picture released by the Israel Police of Baruch Mizrahi, 47, killed on April 14, 2014 near the West Bank city of Hebron (photo credit: AFP/HO/Israel Police)

In April 2014, a few hours before the Passover Seder, Baruch Mizrachi was shot dead in a roadside attack near Hebron. The 48-year-old Israel Police superintendent was killed by Ziad Awwad, a Hamas operative released in the prisoner swap.

Mahmoud Kawasame, one of Hamas operatives who abducted and killed the Israeli teenagers Naftali Fraenkel, Gil-ad Shaar, and Eyal Yifrach in June 2014, in a shocking attack that was among the triggers of the war in Gaza a month later, had also been released by Israel. Kawasame was originally imprisoned for his involvement in a 2004 suicide bus bombing in Beersheba that killed 16 Israelis. He was eventually shot dead by IDF soldiers.

Osama As’ad, a 29-year-old arms dealer from the West Bank refugee camp of Qalandia, who was imprisoned by Israel for selling weapons used in attacks and released under the Shalit deal, was recently rearrested for the lethal West Bank shooting of Danny Gonen in June.

Earlier this month, Prime Minister Benjamin Netanyahu shelved legislation that sought to institute the death penalty for convicted terrorists, in part in an effort to prevent future prisoner swaps.

Gantz, widely considered an officer and a gentleman, greeted Israel's returned captive soldier, Gilad Shalit, on October 18, 2011, with a salute and a hug, telling him to "be strong and everything will ok." (photo credit: IDF Spokesperson's Unit/ Flash 90)

Israel’s chief of staff Benny Gantz greets returned captive soldier Gilad Shalit on October 18, 2011 (photo credit: IDF Spokesperson’s Unit/ Flash 90)