November 14 marked the first anniversary of Operation Pillar of Defense, Israel’s eight-day assault on Gaza with the declared aim of ending rocket fire on Israeli towns.

Prime Minister Benjamin Netanyahu marked the occasion on November 12 with a visit to the desert headquarters of the Israel Defense Force’s Gaza Division and a speech to the troops. What he had to say will surprise you: The operation reduced rocket and mortar fire by 98%. “There is no doubt,” Netanyahu said, according to news reports, “that significant deterrence has been achieved.”

The provocation was substantial. A total of 1,035 rockets and mortar shells had been fired at Israel from Gaza by Hamas and other Islamist groups in the 10.5 months preceding the Israeli assault, January 1 through November 13, 2012.

Israel’s deterrent was in kind: eight days of heavy bombardment, hitting some 1,500 sites ranging from ammunition dumps and rocket launchers to government offices and apartment buildings. An estimated 175 Palestinians dead, of whom either 57 (by Israeli count) or 102 (by Palestinian count) were civilians. The cost to Israel: six dead, including four civilians killed by rocket fire.

The result: a full year afterward, from November 2012 to November 2013, in which Israel was targeted from Gaza by a grand total of 35 rockets.

For all practical purposes, Israel has eliminated the Gaza rocket problem. Hamas has not only stopped firing rockets — it’s aggressively sent its police after the jihadi radicals who want to keep up the barrage. Life in Israel’s southern towns and communities has largely returned to normal, at least for now.

How did Israel do it? On the surface, the solution looks simple. Punish them when they cross the line. Make the price of attacking Israel too high even to consider. Create deterrence, as Netanyahu describes it.

Indeed, that’s a big part of it. But it’s more complicated than that. Hamas had to be shown the benefits of compliance as well as the price of disturbance. Under the November 2012 Egyptian-brokered cease-fire that ended Pillar, Israel agreed to a significant easing of its economic blockade on Gaza. The number of trucks allowed to enter Gaza through the Kerem Shalom crossing was increased and the crossing’s hours of operation were extended.

By the spring, reports from Gaza indicated that grocery shelves were filled with Israeli goods from milk and flour to chocolate bars. Come summer, when Egypt’s new military government began systematically destroying the smuggling tunnels that brought goods into Gaza. Israel agreed to step up its supply. Construction material for the private market was let in for the first time in years, first gravel, then cement, iron and other basics.

The discovery in October of the terror tunnel leading from Gaza to Kibbutz Ein Hashlosha, evidently for attacks or kidnappings, resulted in a shutdown of construction material. But the suspension is expected to be temporary. As much as Israel and Hamas despise each other, it’s in both their interests to maintain stability. Hamas, for all its anarchist and fanatic tendencies, has a statelet to run. It can’t have its people’s homes and businesses repeatedly flattened by Israeli munitions, even if that means smacking down its mad bombers. As for Israel, it needs to have someone on the other side of the border who’s able and willing to keep order.

There’s one more factor in the truce’s success or failure: international legitimacy.

Here it’s instructive to compare the success of Operation Pillar of Defense with the relative weakness of its predecessor, Operation Cast Lead. Like Pillar, Cast Lead came at the tail end of a hellish year, 2008, in which Israel’s southern communities endured about 2,700 rockets and mortars. Unlike the eight-day Pillar campaign, Cast Lead lasted three weeks, escalating rapidly from aerial bombing to massive artillery bombardment and then a ground invasion.

Cast Lead’s goal was not merely to deter terror by raising the price, but to root out the infrastructure of terrorist cells. That proved to be both hugely costly and quickly reversible. The Palestinians lost somewhere between 1,100 and 1,400 souls, but they gained considerable world sympathy. Israel made the mistake of keeping up the offensive long enough for its initial sympathy to dissipate and give way to international revulsion.

The results: For Israel, international isolation, the Goldstone Report, the Gaza flotilla and growing momentum for the Israel-bashing BDS movement. For the Palestinians, a dose of international sympathy that emboldened them to return to rocketeering almost immediately. Through the rest of 2009, nearly 900 rockets were fired at southern Israel — fewer than in 2008, but still intolerable for Israel. Cast Lead was a costly failure.

The two operations have important lessons for Israel and her friends. For one thing, it turns out that it’s possible to live relatively securely, even in a dangerous neighborhood and alongside a sworn enemy, so long as you keep your powder dry and know when to use it — and when to stop. It may be that Israel will have to repeat Pillar of Defense periodically, as long as Hamas sees value in putting its people through hell. What Israel can do is make sure Hamas understands the benefits of keeping the truce and the price of breaking it.

For another, it’s important to remember that strength and firepower, though vital, aren’t everything. Nor is it enough that your actions are justified. They must be seen to be justified. If you lose your legitimacy as a result of your actions — however justified they might seem to you — that legitimacy doesn’t just disappear into the ether. It switches over to the other side.

Finally, there’s this basic truth of Israeli security doctrine: territory isn’t all it’s cracked up to be. Israel didn’t end the hell of Sderot’s bombardment by moving it further away from Gaza and putting more settlements in between. It ended the bombing by giving Hamas compelling reasons to stop.

The same rules hold for the West Bank, with two crucial differences. For one thing, the Palestinian leadership in the West Bank is neither anarchist nor suicidal. It’s learned to keep the peace without having to get hit over the head periodically. It can see the benefits without needing constantly to be reminded of the price. And it’s realistic enough to know that if things go wrong, Israel will exact that price.

For another thing, it’s much harder for Israel to give the West Bank Palestinians the positive inducements necessary for a stable peace — dignity, real sovereignty and a contiguous, viable state. That would require acknowledging their right to their fair share of the land. Too many Israelis are convinced it’s Israel’s. If there’s an inducement to make them want to share, nobody’s found it yet.

Contact J.J. Goldberg at goldberg@forward.com