I cannot help wondering, in the wake of Stevens' murder by a mob in Benghazi - where he had spent months working with the transitional council that served as the political wing of the forces fighting Moammar Gadhafi - if I should understand his optimism about the United States' role in Libya as a ghastly irony.
How many times have I heard American diplomats talk about what the United States was doing or could do or should do, in Egypt and Pakistan and Afghanistan and elsewhere in the Islamic world, to improve its image? Americans are optimistic by nature, and so are American diplomats. I am, too, though perhaps experience should have taught me otherwise. At the time, I wrote, "Libyans are generally well disposed towards the United States thanks to the Obama administration's role in the NATO bombing."
A test case
From his very first day in office, when he gave an interview to Al-Arabiya and called Arab leaders, President Obama has tried to make gestures and shape policy that would change the feelings of people in the Islamic world toward the United States. He delivered his celebrated speech in Cairo in June 2009 in the hope that by offering a new posture based on "mutual interest and mutual respect," he could end the "cycle of suspicion and discord" governing U.S. relations with Arab publics.
Obama's speech sparked a wave of euphoria - and then, as it became clear that he had offered a new tone but not a new policy on the Palestinian territories or America's autocratic allies, a new wave of disappointment. A third of respondents in Muslim countries viewed Obama positively in 2009; now only a quarter do.
So much effort has gone into the campaign to pull the United States from the ditch into which it had sunk in the Middle East and the broader Islamic world. The late envoy Richard Holbrooke insisted that U.S. aid to flood-ravaged Pakistan carry the Stars and Stripes to ensure that Washington got the credit it deserved among Pakistani citizens. But billions in civilian and military assistance have had the opposite effect. Since 2009, the share of Pakistanis who view the United States as an enemy has risen from 64 to 74 percent.
President George W. Bush tried to win Arab publics through democracy promotion; Obama, through deference and respect. Bush made things far worse, but Obama didn't make them much better.
Perhaps it's not their fault. Resentment of the United States - of which the most toxic form is the rage that fueled the crowds in Libya and Egypt, and before that in Afghanistan and Pakistan - serves political and psychological purposes that make it very hard to uproot. Blaming the West, and above all the United States, allows leaders to distract attention from their own failings, ordinary citizens to live with their sense of humiliation, and Islamist and anti-Western parties and factions to burnish their "resistance" credentials.
Of course, if that's true, then nothing the United States does matters - not even using force to help the Libyan people free themselves from their hated dictator, or sending an experienced and dedicated diplomat to prepare the rebels for the burden of governance. Libya is a test case for the belief that Washington can change the way it is seen in the Middle East by doing the right thing.
I am not convinced that the burning of the Benghazi consulate, or even the demonstrations that have followed, show that Stevens and other hopeful folks were deluded. What they show is that a government that does not exercise a monopoly over force cannot stand up to armed extremists eager to exploit religious or nationalist passion. To state the obvious, Stevens was killed not by "Libya," but by a handful of people in a crowd of several hundred. It's unclear whether, as administration officials have reportedly begun to conclude, the violence was premeditated, or whether it was an opportunistic response to the gathering of an angry crowd, but a consensus has begun to form that the attack was carried out by Ansar al-Sharia, a militant group.
Almost as naive
So what does "Libya" think? As my Foreign Policy colleague Marc Lynch has noted, both Libya's leaders and Libyans taking to social media have condemned the attack unequivocally, and have spoken of their high regard for Stevens. The North Africa director for the International Crisis Group, Willliam Lawrence, who is now in Tripoli, says that even Salafist groups have vocally condemned the killing, and Ansar al-Sharia has distanced itself from the rogue elements said to have carried out the violence, inviting Libya's militias to hunt them down and bring them to justice.
But in Cairo, Egyptian President Mohamed Morsi was initially silent about the violence. Egyptian public opinion remains fervently anti-American, and Morsi may fear mounting a public defense of the United States.
So, yes, we should stipulate that Obama was almost as naive as Bush in believing that he, personally, could bring about a sea change in Arab public opinion. The resentment of the United States is deeply rooted, and only partly connected to U.S. behavior.
But that part matters, and it is not naive to believe that deeds can make a difference. The Arab Spring gave the United States a new chance to do the right thing, and it did so in Libya. One of the arguments for more actively siding with the rebels in Syria is that doing so will give the United States standing if and when the rebels triumph.
I don't want to misrepresent my conversation with Stevens. He was much more interested in what the Libyans were doing for themselves than in what the Libyans thought about America.
The reason for his optimism was that Libya had gone to the polls and rejected both separatists and Islamists. The Higher National Election Commission had done a creditable job. Former rebel leaders forming the new army were open to advice, whether from the United States or the United Nations. For Libyans, he said, the United States was appealing above all as a model for their own country's development.
Libya's National Assembly has just chosen a new prime minister, Mustafa Abu Shagur. In the course of the all-day balloting, says the International Crisis Group's Lawrence, "there was a rallying against the prospect of chaos" that swelled support for the moderate candidate Mahmoud Jibril, who lost to Shagur by two votes. Lawrence suggested that the tragedy might serve as a "coming-together moment" for Libya's fragile democracy. If that turns out to be so, then Chris Stevens will not have died in vain.
James Traub is a fellow of the Center on International Cooperation. He wrote this for Foreign Policy.