Now, Mr. Malley is coming back to the White House, administration officials said on Tuesday. This time, he will manage the fraying ties between the United States and its allies in the Persian Gulf, a job that says a lot about how America’s role in the Middle East has changed.
As a senior director at the National Security Council, Mr. Malley will help devise American policy from Saudi Arabia to Iran. It is a region on edge, with the Saudis and their Sunni neighbors in the gulf fearful that the United States is tilting away, after decades of close ties with them, toward a nuclear accommodation with Shiite Iran.
With his many contacts throughout the Arab world, Mr. Malley, who has been program director for the Middle East and North Africa at the International Crisis Group, would seem well suited for such a post. But he has also been something of a lightning rod in a field that can be culturally and ideologically treacherous.
In 2008, Mr. Malley was forced to sever his ties as an informal adviser to the campaign of Barack Obama when it was reported that he had met with members of Hamas, the militant Palestinian group, which the State Department classifies as a terrorist organization.
The meeting, Mr. Malley said in a letter to The New York Times, was hardly a secret and came in the course of his work with the I.C.G., a nonprofit group focused on preventing conflict. Still, he felt obliged to distance himself from Mr. Obama to avoid misperceptions of the "candidate’s position regarding the Islamist movement.”
Mr. Malley also came under fire for writing an article, with Hussein Agha, that argued that some of the blame for the failure of the Camp David talks lay with the Israeli leader at the time, Ehud Barak, and not just with the uncompromising position of the Palestinian leader, Yasir Arafat, which was the conventional wisdom then.
Some right-wing critics accused Mr. Malley of showing a persistent anti-Israel and pro-Palestinian bias in his writings. A few even cited his father, a prominent Egyptian-born Jewish journalist, Simon Malley, who had close ties to the Egyptian government.
But the younger Mr. Malley was stoutly defended by five former colleagues from the Clinton administration — Sandy Berger, Dennis B. Ross, Martin S. Indyk, Daniel C. Kurtzer and Aaron David Miller — who wrote a letter to The New York Review of Books, where Mr. Malley’s Camp David article had appeared, condemning what they said were "vicious, personal attacks” that were "unfair, inappropriate and wrong.”
Some of that old history resurfaced last October when rumors of Mr. Malley’s move to the White House first appeared on the Back Channel, a blog of Al Monitor, the Middle East news website.
But on Tuesday, White House officials played down those controversies, saying Mr. Malley had forged strong relationships, including with officials in the government of Prime Minister Benjamin Netanyahu of Israel.
"There are always differences in tactics,” said Antony J. Blinken, the principal deputy national security adviser. But, he added, "I can’t think of anybody outside government who has a stronger set of relationships with the Israelis, as well as with people throughout the region.”
Mr. Malley was also considered for a post at the State Department, where his former colleague Mr. Indyk is Secretary of State John Kerry’s special envoy for Israeli-Palestinian negotiations. Working for Mr. Indyk would have been a return to familiar ground.
But with the departure of Puneet Talwar, the current senior director for the Persian Gulf, Iraq and Iran, who has been nominated as assistant secretary of state for political-military affairs, the more intriguing opening for Mr. Malley was at the National Security Council.
Unlike Mr. Talwar, who took part in secret, face-to-face negotiations with Iran before the signing of its interim nuclear deal with six world powers, Mr. Malley will not be heavily involved in nuclear negotiations, the latest round of which began on Tuesday in Vienna.
That role will fall to Brooke D. Anderson, a former aide to Ambassador Susan E. Rice at the United Nations, who has joined the American delegation as senior adviser to the lead American negotiator, Wendy R. Sherman, the under secretary of state for political affairs.
In any event, Mr. Malley, who declined to comment about his new job, will have plenty to keep him occupied. Next month, Mr. Obama is scheduled to visit Saudi Arabia to meet with King Abdullah on what officials said would be a fence-mending mission.
Saudi Arabia has been frustrated by Mr. Obama’s unwillingness to do more to support rebel forces in Syria. The Saudis have funneled weapons to the rebels, in part because they view the civil war there as a proxy battle between Sunni Arabs and Shiite Iran, which is an important backer of the Syrian president, Bashar al-Assad.
These frictions have occurred during a period in which American ties with Saudi Arabia have loosened anyway, in part because of reduced American dependence on Saudi oil and in part because of the upheavals of the Arab Spring, notably in Egypt. All of these doubts were crystallized by the nuclear diplomacy with Tehran.
"It’s understandable that countries in the region worry that if we were to achieve a nuclear deal with Iran, we will stop worrying about issues with Iran that concern them,” Mr. Blinken said. "The answer to that is, we won’t.”
"There is a very strong foundation to our commitment to their security,” he continued. "Part of this is continuing reassurance that that remains front and center.”
Providing that reassurance will be one of Mr. Malley’s main tasks at the White House. And given the depth of the changes in the Middle East, it may prove no less challenging than bringing together the Israelis and the Palestinians was 14 years ago.