(CNN) -- Israel is freeing more than 1,000 Palestinian prisoners, including hundreds serving life sentences for attacks on Israelis, in exchange for Israeli soldier Gilad Shalit who was captured by Hamas in 2006. How and why has the controversial deal come about?
Why is Shalit considered important enough by the Israelis to be exchanged for so many Palestinian prisoners?
Militants captured the young sergeant in June 2006 after tunneling into the Jewish state and attacking an Israeli army outpost. Israel immediately launched a military incursion into Gaza to rescue Shalit, then 19, but failed to free him.
As the Israeli attacks continued, the Palestinians death toll steadily grew -- hundreds killed, many militants, but also, according to Palestinian sources, innocent men women and children.
Shalit's captors, affiliated with the Islamic Hamas government, demanded a prisoner swap, but the Israeli government said no -- at least in public.
Until Tuesday, when Shalit was freed and returned to Israel, he was held incommunicado by Hamas, which controls Gaza.
Efforts to free him became a rallying cry for thousands of Israelis who urged the government to secure his release. Shalit's supporters feared that if a deal was not reached, his fate could have become similar to that of Israeli Air Force Navigator Ron Arad, who crashed his warplane in Lebanon 25 years ago. He was captured by a local Shiite Amal militia and later handed over to Hezbollah, Shiite militants strongly influenced by Iran and now in de facto control of Lebanon.
Despite reported attempts to negotiate his return, Israel failed to free Arad and the trail went cold. Over the years he became a symbol of the failure of successive Israeli governments to strike a deal that would bring him back alive. In June 2008 Hezbollah announced Arad was dead.
Who are the Palestinians being freed by Israel?
Israel Monday announced it would release 1,027 prisoners and it identified the first 477 to be freed Tuesday. The group includes two prominent female prisoners: Ahlam Tamimi, serving life terms for being an accomplice in the 2001 bombing of a Sbarro pizza restaurant that killed 15 people; and Amneh Muna, who plotted the killing of a 16-year-old Israeli boy in 2001 and received a life sentence. Twenty-five other women will also be freed.
The most notable name not on the list is that of jailed Palestinian lawmaker Marwan Barghouti, who is serving five life sentences for murder and other charges related to his role in planning attacks on Israelis during the second Intifada.
He had been considered by many Palestinians the most important prisoner who might have been released in exchange for Shalit.
How is the handover taking place?
The first swap took place Tuesday, with a second stage scheduled for later this year. Israel freed 477 Palestinian inmates from Israeli jails shortly before Shalit was released, the first group of a batch of more than 1,000 Palestinians being swapped for Shalit's freedom.
Freed prisoners praised Egypt's role as a mediator in interviews on Palestinian television after they were released.
Some are being sent to the West Bank and others to Gaza, while just under half are being sent abroad. A handful are going to homes in Jerusalem, elsewhere in Israel or to Jordan.
Once freed, they will be under various restrictions on a case-by-case basis: Some will not be allowed to leave the country, while others will have restrictions on their movement or be required to report their whereabouts to local police according to Justice Ministry spokesman Moshe Cohen.
Hamas later handed Shalit over to Egyptian security forces, and he later crossed into Israel. Egyptian television showed a short clip of Shalit walking unaided with an escort of about half a dozen people soon after his release was announced. He looked thin and dazed, wearing a dark baseball cap and collared shirt.
Shalit will undergo medical tests and debriefing at an air force base, the Israeli military said. Once that is complete, he will be flown to his home at Mitzpe Hila, north of Haifa.
Why is this happening now?
Speaking to his Cabinet this week, Israeli Prime Minister Benjamin Netanyahu said that with so much change sweeping the region, he did not know whether a better deal for Shalit was possible, and warned that he didn't act during this window of opportunity, it could close indefinitely.
It represented a vast change in outlook and rhetoric for the combative prime minister, who seems to have calculated that a softer approach was the more politically expedient road to follow.
Whether it was the prospect of going down in history as the Israeli leader who missed the chance to free Shalit, the calculation of larger geopolitical changes in the region, or a mere reflection of public sentiment, Netanyahu has chosen a path that has taken him away from much of what he has spent decades preaching.
The Hamas rulers of Gaza also felt pressure to make the deal now. The rival Palestinian Authority that governs parts of the West Bank is enjoying increased popularity following its recent United Nations bid for recognition of an independent state and a large scale prisoner release was seen by many in Hamas as a way of seizing back the political initiative. Hamas is also contemplating moving its headquarters out of Damascus and concluding the Shalit deal would make it easier to negotiate a possible relocation to Cairo with the post-Mubarak Egyptian government.
What is the reaction in Israel and the Palestinian territories?
The deal to free Shalit was backed by a commanding Israeli Cabinet majority of 26-3 and enjoys wide support from the Israeli public, but there was extensive debate about whether so many Palestinian prisoners should be freed.
Families of victims of terror, as well as some members of the Israeli government, have expressed fierce opposition to the deal. One minister who voted against the agreement called it "a great victory for terrorism," and there are fears that the release of convicted murderers will lead to further attacks on Israeli civilians -- a fear that, critics say, is borne out by statistics. According to the Israeli association of terror victims, Almagor, 180 Israelis have lost their lives to terrorists freed in previous deals since 2000.
For Palestinians the issue of prisoners in Israeli prisons cuts deep. For several decades human rights groups estimate that hundreds of thousands of Palestinians have spent time in Israeli prisons for a wide range of alleged crimes. In many cases Palestinians face incarceration without any formal charges, and children under the age of 18 are frequently detained for offenses like rock-throwing. Most Palestinians see these inmates and those convicted of violent crimes against Israeli citizens as political prisoners detained within the course of an ongoing liberation struggle.
Palestinians in both the West Bank and Gaza welcomed the prospect of so many prisoners being released but there are reservations about the conditions requiring many of them to be exiled from their homeland.
One Palestinian in Ramallah told CNN, "If I was a prisoner and I am released, I need to go to my family, my country, to my city. Why send me to Turkey or Venezuela whatever -- why?"
How will this affect the peace process?
Israelis are equally split on whether "the release of terrorists" will harm Israeli security, with 50% saying Yes and 48% saying No -- a statistical deadlock given the margin of error for the number of people polled.
One expert, Ronald W. Zweig, the Taub Professor of Israel Studies at New York University, said the deal showed that both sides had made concessions. "And that is a sign of hope."
"Pessimists will point to the dangers of rewarding terror -- both the terror of those released from jail and the act of kidnapping Israelis to have future terrorists released. Cynics will ask if Israel's willingness to conclude the deal was not an attempt to punish (Palestinian Authority President Mahmoud) Abbas for pushing ahead with his policies in the U.N., despite Israeli and American opposition," Zweig wrote in a recent commentary for CNN.
"But there are other considerations which give grounds for optimism. Any movement in the stalled peace process might be enough to get the wheels of this heavy cart out of the rut in which it is trapped. It appears that Turkish President Recep Tayyip Erdogan had a role in the final deal, perhaps indicating a return of Turkey to constructive dealing with Israel. And the fact that Israel and Hamas have talked -- albeit indirectly -- is a welcome development. Israel's 2005 withdrawal from Gaza might have had more positive long-term effect had this channel of communication been used then.
"Even more significant, the release of these prisoners removes a major obstacle from any future peace settlement between Israel and the Palestinians."
CNN's Jerusalem Bureau Chief Kevin Flower and Guy Azriel contributed to this report.