It’s so rare in the Middle East that an event inspires celebrations from Jews and Arabs that one can understand people wanting to just savor the moment — the exchange this week that freed captured Israeli soldier Gilad Shalit and hundreds of Palestinian prisoners.

But the celebrations are unable to hide the fact that Middle East peace seems further away than ever, and that in an important sense the prisoner swap is not a portent of peace but a symptom of its remoteness.

If anything is to be done about that, some lessons need to be learnt from the past few days’ events.

The first point is perhaps the most obvious: Israel and Hamas really can talk to each other. Not only that, but they were able to do so productively, in stark contrast to recent interactions between Israel and the official Palestinian leadership of Mahmoud Abbas. As Daniel Levy put it in Foreign Policy,

“Israeli negotiations with Hamas tend to be more serious and contain a greater degree of respect (albeit begrudging) for an adversary.”

For the Israeli right, the ascendancy of Hamas following the 2006 elections proved to be a godsend. It gave them credibility in their assertion that there was no “partner for peace” on the Palestinian side and allowed them to stonewall on negotiations, despite pressure from Europe and the US.

But until now this has not been a good year for Hamas. Its stewardship of Gaza is seen as a failure, the much-promised reconciliation with Abbas’s Fatah has failed to materialise, and the Arab Spring has cast doubt on its confrontational model. According to a survey reported this month in Time, it support is down to just 28%, having fallen especially among young people.

At the same time, Abbas had gained fresh standing from his UN push for recognition of Palestinian statehood. All the more reason, then, for Benyamin Netanyahu to decide to give Hamas a boost and take Abbas down a peg or two. Because Shalit’s release is popular in Israel, it also strengthens Netanyahu domestically against any criticism for failure to advance the peace process.

If Netanyahu and Likud were serious about peace, of course, such an approach would make no sense. Why go out of your way to weaken Abbas, the most compliant Palestinian leader Israel is ever likely to get, and strengthen the very hardliners that you’ve been telling the world you can never negotiate with?

But as soon as you assume that Israel’s Right doesn’t actually want peace — at least not on terms that the Palestinians could conceivably accept — then everything falls into place. Netanyahu doesn’t want a credible interlocutor; he wants a weak and divided Palestinian leadership at war with itself. Hence the need to play off Hamas against Fatah, and help whichever one seems to be flagging.

There’s also a more general lesson for the region. This year’s revolution has made Egypt a more serious and less predictable player; both players in the Shalit negotiation took their chance now because they couldn’t be sure that Egyptian mediation would be any more favorable for them in the future.

Whoever ends up running Egypt, they are unlikely to be strong partisans of Israel, so if Western policy is not to fall apart completely then the US and its allies need to develop workable relations with all of the Egyptian parties — including Hamas’s counterpart, the Muslim Brotherhood.

Six years ago, before the Hamas election victory stood things on their head, the US was seriously contemplating a rapprochement with the Brotherhood, expecting it to have a place in a future democratic Egypt. After many twists and turns we seem to have returned to much the same spot, and the conclusion is the same: however much we dislike the fundamentalists, trying to lock them out does more harm than good.

Israel, albeit for its own impure motives, has shown that negotiation can bring results. Now others need to take the hint.