After the surrender of the Nazis, Winston Churchill declared, “In war, resolution. In victory, magnanimity.”

When the latest deadly conflict with Hamas finally winds down, Israel can show some of that spirit in the interest of its own future and that of the people of Gaza with an overture toward peace.

Prime Minister Benjamin Netanyahu, who has always proven more politician than leader, can help himself and his people by learning from a legend of his own country.

When Menachem Begin took the boldest chance on peace talks, and ultimately a treaty, with Egypt in 1979, 85 percent of Israelis were mistrustful. By the time the Camp David Accords were signed, however, 80 percent were in favor, and Begin has been vindicated by history. Calm between the two countries endures, and while it may not mirror the relationship of the U.S. and Canada, it is an all-too-rare Middle East peace.

Despite the Quartet’s openness to recognizing a united Palestinian leadership linking Fatah and Hamas, with conditions, Netanyahu has shut the door on any dealings with the latter group, which was democratically elected to represent the population of Gaza.

Part of the rationale for this month’s intense campaign against Hamas was to weaken its popularity, despite the failure of prior campaigns to do so, as “the street” tends to blame Israel for any destruction, irrespective of the provocation.

How long can Netanyahu hold out against recognizing Hamas while continuing to claim it’s the Palestinians who are the obstructionists in the stalled peace talks?

It remains to be seen whether either side will come out of the conflict better off. Palestinian casualties have been far higher, but only because Israel’s Iron Dome warded off the most dangerous of a new wave of long-range rockets that reached as far as Tel Aviv and the outskirts of Jerusalem.

It’s even less clear why Hamas initially balked at the Egypt-brokered deal on July 15, reinforcing its rejectionist reputation, earning the direct condemnation of Secretary of State John Kerry, and giving the IDF a rationale and perhaps some international support to further weaken Hamas targets in a process generals call “mowing the lawn,” knocking down offensive capability until the next visit is due.

It’s likely Hamas’ leaders viewed the deal as a preconceived Egyptian dictation in favor of Israel, preferring the violent status quo.

Had Hamas gone the other way, it would have suggested to Israel’s critics that the radical group did not want the conflict and would seek a quick end at the first opportunity.

Still, no matter how much they harm their own cause, and no matter how deadly their actions, Israel must begin to look at Hamas as a lesser evil than other malignant movements such as al Qaeda and ISIS.

Those groups wish to reestablish the Islamic Caliphate and impose Sharia laws, which they have done in regions they control in Iraq and Syria. They have conducted brutal public executions, including beheadings. They may have followers in Gaza and some inspiration in the West Bank. Faced with this reality, Israel should  recognize the ability of Hamas, when properly motivated, to subdue more dangerous elements.

Bringing Hamas to its knees, while politically popular in the short term, could empower those other elements to gain a foothold in the Palestinian-controlled territories.

While Hamas’s stated goal is the eradication of Israel, its more immediate, pragmatic goal is to gain more open access to Gaza via land and sea, hoping that more international pressure will force Israel and Egypt to loosen restrictions on ports and border crossings. They would surely prefer not to depend on Israel for water, power and fuel.

The radical groups vying for control of Syria and Iraq have a much more radical and immediate agenda of imposing Sharia law and setting up a vast fundamentalist state that spans the Middle East.

Choosing between jihad-focused elements has often been compared to picking cholera or the Plague. But choose Israel must. The Fatah faction that dominates the Palestinian Authority once completely rejected Israel’s existence. Even Hamas founder Sheikh Ahmed Yassin reportedly offered Israel a 30-year truce at in 1997.

In the absence of any framework of an agreement, the airstrike/rocket exchanges, which serve no one’s interests, are starting to occur in shorter intervals. The “grass” grows tall more quickly, and tragedies such as the murder of Israeli youths and apparent revenge murder of a Palestinian stand to touch off more dangerous exchanges involving more and more dangerous weapons, with civilians powerless to effect policy on both sides caught in the middle.

It’s time for Israel’s leaders to think outside the box and cement better strategic ties with pragmatic Muslim countries like Egypt, Turkey, Saudi Arabia and Jordan. That could make Israel more confident to take some first steps, under the auspices of the United States, to engage with Hamas.

After all, the only other alternative to perpetual conflict that has been discussed by the cabinet is to reoccupy Gaza, turning the clock back to 2005 with 1.8 million Palestinian lives again under full Israeli control.

Many military leaders are divided on this issue, but as a colonel myself, I don’t believe it is a strategic threat to use a hudna, or ceasefire, as an opportunity to see if Hamas is truly invested in improving the lives of Gaza’s people. Perhaps they’ll demonstrate some interest in whittling away at 90 percent unemployment in favor of ties that could attract international investment and long-term regional cooperation.

Given the current climate, it’s a long shot, to be sure. But if it happens, Israel and Hamas could one day realize the third part of Churchill’s advice:

“In peace, goodwill.”