If Machiavelli were counseling the Hamas leadership today he would give them hard advice. Be smarter about war, he would say. Know that both victory and defeat are not easy to get right. It’s possible, for example, to win a war but lose the peace and it’s also possible to lose a war and yet get something valuable out of peace. Hamas’s problem now is to recognize its strategic failure and lose your war in the best possible circumstances, meaning the least damaging way.

Let’s assume your leadership (or the core group in your divided movement) really cares about its historical legacy rather than an outdated idea of Noble Resistance to the Occupation. It’s time to accept that you will never defeat Israel and that your military-terrorist operations are having a disastrous effect on Gaza and its people and in fact the whole Palestinian cause. You must accept this defeat but in the right way at the right time, beginning as soon as possible. This requires that you must change your mind-set. You can in this way still maximize gains of your long defiance and minimize further destruction of your raison d’etre, your territory, your reputation and above all your people.

Resistance is a fine thing, but remember that too much of a good thing is a bad thing. Wisdom of a leadership group sees when the game is over and the right thing is, with however much sadness, to come to terms with your enemy. Israeli leader Yitzhak Rabin’s poignant statement about dealing with Arafat is classic: ‘One makes peace with one’s enemies, not one’s friends.’

Over the next few years, beginning in current negotiations with Israel in Cairo, Hamas must get clear on what is negotiable and what is not. Airports and ports may be negotiable but not by you. You will have to get out-of-the-way, perhaps by losing an election that is the alternative to being taken down like the Egyptian Muslim Brotherhood. Don’t continue to attempt the impossible after too many years have shown that grievance has made you dizzy and grief has confused your calculations.

Look forward to the day when rewriting your Charter is possible for this will have good results for Palestinians as a whole. Khaled Meshaal in 2010 told a reporter that the Charter “is a piece of history and no longer relevant but cannot be changed for internal reasons.” Yet strong leaders can change internal reasons. As things stand, the Charter, drafted in 1988, 25 years ago, is a bugaboo threat to Israel’s existence that serves Israel’s (and its supporters) purpose: they say you can’t be negotiated with or taken at your word. Revise the Charter and you gain at least tentative legitimacy in the eyes of outside powers (don’t expect the Israelis ever to trust you).

Know, furthermore, that the self-flattering threat to annihilate the enemy is part of what enrages Israelis, giving them justification for drastic solutions. Your repeated rearmament is completely unacceptable to them — as it would be to any government. Rearmament combined with the Charter’s menace serves to justify collective punishment of Palestinians as the lesser of two evils for Israel. It must destroy your weapons and kill your militants in spite of appalling human costs — for which Israel has to take responsibility and it does. Thus Israeli anguish. No one should think Israeli leaders or soldiers enjoy killing civilians, let alone children. But if you leave Israel only the choice between their children and your children, you must take responsibility for the logical result. Yet you don’t.

As for Hamas’s final goal: Gazans and West Bank Palestinians know Israel’s existence is not threatened by you. They know there’s little value for them in your rockets and tunnels and kidnapping. Abu Mazen asked the right question: ‘What does Hamas hope to achieve with their rockets?’ This is pin-prick war. Gazans are not masochists and no longer should be asked to pay a terrible price for a terrorist foreign policy conceived by a small minority of their population, a few tens of thousands in a population of 1.8 million, whose political mandate as a government has lost all legitimacy. Hamas as a government can’t even pay civil servants’ salaries that support families (but you spent tens of millions on the tunnels).

Your wish is to be admired and even loved by your people. You are more likely to end up hated and disdained. You are not David against Goliath. You are gang leaders dragging your neighbors into houses about to explode.

Finally, think geopolitically. Put your own small war in the context of all the other deadly conflicts in the Middle East. You are a small organization in a small territory with few friends and even those are allies of convenience. The Arab monarchies dropped your cause long ago and post-Muslim Brotherhood Egypt is taking a very hard-line with you. Hezbollah is now silent on your behalf, having decided — what a wrong move! — to fight for Bashar Assad. Iran is focused on negotiating its nuclear program with the P-5 to get out from under economic sanctions and its allying with the Americans to stop ISIS. Even your so-called Islamist friends are worrisome. Forget Islamic Jihad for starters, down the line appears ISIS/Islamic State, which considers you to be infidel.

It’s time to re-evaluate the West Bank Palestinians. Be careful in judging them, your enemy brothers Fatah, Abu Mazen, the PLO and Palestinian Authority, and their internationally respected American-educated economists and business people whom you disdain.

How the PA has moved strategically and politically is an example of trying to lose a war well even if the taste is bitter. They are not (certainly contrasted with you), the worst possible leadership for the Palestinian future. They’ve heard the echo of Machiavellian realism: the best course in a lost cause is to seek the least damaging defeat, then disguise what you’re doing. This sounds to you like giving in but it’s really moving forward.