Iranian officials sometimes respond to accusations that Tehran is seeking a nuclear weapons capability by replying that, not only do they not want a bomb, they'd actually like to see a nuclear-weapons-free Middle East. Yes, this is surely in part a deflection, meant to shift attention away from concerns about Iran's nuclear activities by not-so-subtly nodding to the one country in the region that does have nuclear weapons: Israel.

But could Iran have a point? Is there something hypocritical about the world tolerating Israel's nuclear arsenal, which the country does not officially acknowledge but has been publicly known for decades, and yet punishing Iran with severe economic sanctions just for its suspected steps toward a weapons program? Even Saudi Arabia, which sees Iran as its implacable enemy and made its accommodations with Israel long ago, often joins Tehran's calls for a "nuclear-free region." And anyone not closely versed in Middle East issues might naturally wonder why the United States would accept Israeli warheads but not an Iranian program.

"This issue comes up in every lecture I give," Joe Cirincione, president of the nuclear nonproliferation-focused Ploughshares Fund, told me. The suspicions that Israel gets special treatment because it's Israel, and that Western countries are unfairly hard on Israel's neighbors, tend to inform how many in the Middle East see the ongoing nuclear disputes. "It is impossible to give a nuclear policy talk in the Middle East without having the questions focus almost entirely on Israel," Cirincione said.

Of course, many Westerners would likely argue that Israel's weapons are morally and historically defensible in a way that an Iranian program would not be, both because of Israel's roots in the Holocaust and because it fought a series of defensive wars against its neighbors. "Israel has never given any reason to doubt its solely defensive nature," said Robert Satloff, executive director of the Washington Institute for Near East Policy, summarizing the American position. "Israel has never brandished its capabilities to exert regional influence, cow its adversaries or threaten its neighbors."

There's truth to both of these perspectives. But the story of the Israeli nuclear program, and how the United States came to accept it, is more complicated and surprising than you might think.

The single greatest factor explaining how Israel got the world to accept its nuclear program may be timing. The first nuclear weapon was detonated in 1945, by the United States. In 1970, most of the world agreed to the nuclear Non-Proliferation Treaty, which forbids any new countries from developing nuclear weapons. In that 25-year window, every major world power developed a nuclear weapon: the Soviet Union, United Kingdom, France and China. They were joined by exactly one other country: Israel.

The Israeli nuclear program was driven in many ways by the obsessive fear that gripped the nation's founding prime minister, David Ben-Gurion. After the 1948 Arab-Israeli war, in which the new country fought off Egyptian and Jordanian armies, Ben-Gurion concluded that Israel could survive only if it had a massive military deterrent — nuclear weapons.

"What Einstein, Oppenheimer and Teller, the three of them are Jews, made for the United States could also be done by scientists in Israel for their own people," Ben-Gurion wrote in 1956. Avner Cohen, the preeminent historian of Israel's nuclear program, has written that Ben-Gurion "believed Israel needed nuclear weapons as insurance if it could no longer compete with the Arabs in an arms race, and as a weapon of last resort in case of an extreme military emergency. Nuclear weapons might also persuade the Arabs to accept Israel's existence, leading to peace in the region."

But Israel of the 1950s was a poor country. And it was not, as it is today, a close political and military ally of the United States. Israel had to find a way to keep up with the much wealthier and more advanced world powers dominating the nuclear race. How it went about doing this goes a long way to explaining both why the United States initially opposed Israel's nuclear program and how the world came around to accepting Israeli warheads.

So the Israelis turned to France, which was much further along on its own nuclear program, and in 1957 secretly agreed to help install a plutonium-based facility in the small Israeli city of Dimona. Why France did this is not settled history. French foreign policy at the time was assiduously independent from, and standoffish toward, the United States and United Kingdom; perhaps this was one of France's many steps meant to reclaim great power status. A year earlier, Israel had assisted France and the United Kingdom in launching a disastrous invasion of Egypt that became known as the "Suez Crisis"; French leaders may have felt that they owed Israel. Whatever France's reason, both countries kept it a secret from the United States.

When U.S. intelligence did finally discover Israel's nuclear facility, in 1960, Israeli leaders insisted that it was for peaceful purposes and that they were not interested in acquiring a nuclear weapon. Quite simply, they were lying, and for years resisted and stalled U.S.-backed nuclear inspectors sent to the facility. (This may help shed some light on why the United States and Israel are both so skeptical of Iran's own reactor, potentially capable of yielding plutonium, under construction at Arak.) The work continued at Dimona.

Gradually, as the United States came to understand the scope of the program, the administrations of Dwight D. Eisenhower, John F. Kennedy and even the relatively Israel-friendly Lyndon B. Johnson all pushed ever harder to halt Israel's nuclear development. Their response to an Israeli bomb was "no."

"The U.S. tried to stop Israel from getting nuclear weapons and to stop France from giving Israel the technology and material it needed to make them," Cirincione said. "We failed."

The turning point for both Israel and the United States may have been the 1967 war. The second large-scale Arab-Israeli war lasted only six days, but that was enough to convince Israeli leaders that, though they had won, they could lose next time. Two crucial things happened in the next five years. First, in 1968, Israel secretly developed a nuclear weapon. Second, and perhaps more important, was a White House meeting in September 1969 between President Richard Nixon and Israeli Prime Minister Golda Meir. What happened during that meeting is secret. But the Nixon's administration's meticulous records show that Secretary of State Henry Kissinger said to Nixon, in a later conversation about the Meir meeting, "during your private discussions with Golda Meir you emphasized that our primary concern was that Israel make no visible introduction of nuclear weapons or undertake a nuclear test program."

That meeting between Nixon and Meir set what has been Israel's unofficial policy ever since: one in which the country does nothing to publicly acknowledge or demonstrate its nuclear weapons program, and in exchange the United States would accept it. The Nixon administration had concluded that, while it didn't like the Israeli weapons program, it also wasn't prepared to stop it. The Cold War had polarized the Middle East, a region where Soviet influence was growing and where Israel — along with Iran — were scarce American allies. If they had already resigned themselves to living with a nuclear weapon, Kissinger concluded, they might as well make it on their terms.

"Essentially the bargain has been that Israel keeps its nuclear deterrent deep in the basement and Washington keeps its critique locked in the closet," Satloff explained.

If the 1967 war had sparked Israel's rush to a warhead and led the United States to tacitly accept the program, then the 1973 Arab-Israeli war made that arrangement more or less permanent. Egypt and Syria launched a joint surprise attack on Yom Kippur and made rapid gains — so rapid that Israeli leaders feared that the entire country would be overrun. They ordered the military to prepare several nuclear warheads for launch — exactly the sort of drastic, final measure then Ben-Gurion had envisioned 20 years earlier. But the Israeli forces held, assisted by an emergency U.S. resupply that Nixon ordered, and eventually won the war.

The desperation of the 1973 war may have ensured that, once Nixon left office, his deal with the Israelis would hold. And it has. But the world has changed in the past 40 years. Israel's conventional military forces are now far more powerful than all of its neighbors' militaries combined. Anyway, those neighbors have made peace with Israel save Syria, which has held out mostly for political reasons. From Israel's view, there is only one potentially existential military threat left: the Iranian nuclear program. But that program has not produced a warhead and, with Tehran now seeking to reach an agreement on the program, it may never.

Some scholars are beginning to ask whether the old deal is outdated, if Israel should consider announcing its nuclear weapons arsenal publicly. Cohen, the historian who studies the Israel program, argues that the policy of secrecy "undermines genuine Israeli interests, including the need to gain recognition and legitimacy and to be counted among the responsible states in this strategic field."

The dilemma for Israel is that, should Iran ever develop a nuclear warhead, Israel will surely feel less unsafe if it has its own nuclear deterrent. But, ironically, Israel's nuclear arsenal may itself be one of the factors driving Iran's program in the first place.

"History tells us that Israel's position as the sole nuclear-armed state in the region is an anomaly — regions either have several nuclear states or none," said Cirincione, of the nonproliferation Ploughshares Fund. "At some point, for its own security, Israel will have to take the bombs out of the basement and put them on the negotiating table."

Some scholars suggest that world powers, including the United States, may have quietly tolerated Egyptian and Syrian chemical weapons stockpiles as counterbalances to Israel's own weapons of mass destruction; a concession just large enough to prevent them from seeking nuclear weapons of their own.

Ultimately, while every president from Nixon to Barack Obama has accepted Israel's nuclear weapons, at some point the United States would surely prefer to see a Middle East that's entirely free of weapons of mass destruction.

"We are not okay with Israel having nuclear weapons, but U.S. policymakers recognize that there is not much we can do about it in the short-term," Cirincione said. "But these are general back-burner efforts. All recognize that Israel will only give up its nuclear weapons in the context of a regional peace settlement where all states recognized the rights of other states to exist and agree on territorial boundaries. This would mean a settlement of the Israeli-Palestinian issues."

In other words, the Middle East would have to cease being the Middle East. Maybe that will happen, but not anytime soon.