Jimmy Carter will go down in American history as "the president who lost Iran," which during his term went from being a major strategic ally of the United States to being the revolutionary Islamic Republic. Barack Obama will be remembered as the president who "lost" Turkey, Lebanon and Egypt, and during whose tenure America's alliances in the Middle East crumbled.

The superficial circumstances are similar. In both cases, a United States in financial crisis and after failed wars loses global influence under a leftist president whose good intentions are interpreted abroad as expressions of weakness. The results are reflected in the fall of regimes that were dependent on their relationship with Washington for survival, or in a change in their orientation, as with Ankara.

America's general weakness clearly affects its friends. But unlike Carter, who preached human rights even when it hurt allies, Obama sat on the fence and exercised caution. He neither embraced despised leaders nor evangelized for political freedom, for fear of undermining stability.

Obama began his presidency with trips to Turkey, Egypt and Saudi Arabia, and in speeches in Ankara and Cairo tried to forge new ties between the United States and the Muslim world. His message to Muslims was "I am one of you," and he backed it by quoting from the Koran. President Hosni Mubarak did not join him on the stage at Cairo University, and Obama did not mention his host. But he did not imitate his hated predecessor, President George W. Bush, with blunt calls for democracy and freedom.

Obama apparently believed the main problem of the Middle East was the Israeli occupation, and focused his policy on demanding the suspension of construction in the settlements and on the abortive attempt to renew the peace talks. That failure led him to back off from the peace process in favor of concentrating on heading off an Israeli-Iranian war.

Americans debated constantly the question of whether Obama cut his policy to fit the circumstances or aimed at the wrong targets. The absence of human rights issues from U.S. policy vis-a-vis Arab states drew harsh criticism; he was accused of ignoring the zeitgeist and clinging to old, rotten leaders. In the past few months many opinion pieces have appeared in the Western press asserting that the days of Mubarak's regime are numbered and calling on Obama to reach out to the opposition in Egypt. There was a sense that the U.S. foreign policy establishment was shaking off its long-term protege in Cairo, while the administration lagged behind the columnists and commentators.

The administration faced a dilemma. One can guess that Obama himself identified with the demonstrators, not the aging dictator. But a superpower isn't the civil rights movement. If it abandons its allies the moment they flounder, who would trust it tomorrow? That's why Obama rallied to Mubarak's side until Friday, when the force of the protests bested his regime.

The street revolts in Tunisia and Egypt showed that the United States can do very little to save its friends from the wrath of their citizens. Now Obama will come under fire for not getting close to the Egyptian opposition leaders soon enough and not demanding that Mubarak release his opponents from jail. He will be accused of not pushing Prime Minister Benjamin Netanyahu hard enough to stop the settlements and thus indirectly quell the rising tides of anger in the Muslim world. But that's a case of 20:20 hindsight. There's no guarantee that the Egyptian or Tunisian masses would have been willing to live in a repressive regime even if construction in Ariel was halted or a few opposition figures were released from jail.

Now Obama will try to hunker down until the winds of revolt die out, and then forge ties with the new leaders in the region. It cannot be assumed that Mubarak's successors will be clones of Iran's leaders, bent on pursuing a radical anti-American policy. Perhaps they will emulate Turkey's prime minister, Recep Tayyip Erdogan, who navigates among the blocs and superpowers without giving up his country's membership in NATO and its defense ties with the United States. Erdogan obtained a good deal for Turkey, which benefits from political stability and economic growth without being in anyone's pocket. It could work for Egypt, too.