The exchange of some 1,000 Palestinian prisoners for one kidnapped Israeli soldier is a victory for humanitarianism in a region too often characterized by brutality. The decision by Israeli Prime Minister Benjamin Netanyahu to make the deal goes against every one of his impulses, which were over-ridden in this case by his political pragmatism. Especially difficult for him to swallow is the boost it gives to Hamas, the Islamist group that controls the Gaza Strip: It is considerably strengthened by having negotiated the exchange.

Sgt. Gilad Shalit was captured by Hamas fighters five years ago. The militants had passed into Israeli territory through an underground tunnel, engaged Israeli soldiers in a firefight and grabbed Mr. Shalit when he was wounded. Reportedly, the seizure was planned: Two Hamas fighters, seized by Israeli forces the day before Mr. Shalit was taken, had said that Hamas was planning to enter Israel via tunnels and kidnap Israeli soldiers stationed nearby. The day after he was seized, Hamas called on Israel to release all Palestinian prisoners under the age of 18 and all women held captive. Israel refused, launching a five-year captivity for Mr. Shalit.

Negotiations for his release continued; at various times, the Vatican, the Russian government and the Egyptian government served as intermediaries, all to no avail. Obstacles included the number of Palestinian prisoners to be released, which prisoners would be set free, and where they would be released. Reportedly a deal was struck earlier in October that would release Mr. Shalit in exchange for an eventual 1,047 Palestinian prisoners. On Oct. 18, Mr. Shalit was set free and Israel released the first 447 of its Palestinian prisoners. The remaining 550 will be set free in December.