Even then, the polarized views about the NATO-led intervention were on display, as were the dangers of diplomacy in a turbulent nation. The rebels fighting Col. Muammar el-Qaddafi had hoisted American, British and French flags in the plaza in Benghazi that they renamed Freedom Square, Mr. Stevens often recalled, but a car bomb later exploded in the parking lot of the hotel where he had settled.
That forced him to move into the villa in Benghazi where, more than a year later, he died Tuesday. Mr. Stevens, 52, and three other State Department employees were killed during a prolonged assault on the consulate, which he was visiting to inaugurate a cultural center as part of his efforts to deepen ties in a new Libya.
He became the first United States ambassador killed in an attack while on duty since Adolph Dubs was kidnapped and killed in Kabul, Afghanistan, in 1979. The circumstances of the attack - including the motives and any security lapses - are still not known.
"It's especially tragic that Chris Stevens died in Benghazi," President Obama said in the White House Rose Garden on Wednesday, "because it is a city that he helped to save."
Mr. Stevens, who was fluent in Arabic, knew better than most diplomats in the American Foreign Service the opportunities and travails facing Libya after the fall of Colonel Qaddafi, and was undaunted.
"The image of the striped-pants ambassador who goes to cocktail parties and steeples his hands - that was not Chris Stevens," said Jeffrey D. Feltman, a former assistant secretary of state and now under secretary general at the United Nations, who worked closely with him.
After having served as the deputy ambassador during Colonel Qaddafi's rule, Mr. Stevens became the Obama administration's main interlocutor to the rebels based in Benghazi who ultimately overthrew him with the help of NATO airstrikes. Mr. Obama rewarded Mr. Stevens with the nomination to become the first ambassador in a post-Qaddafi Libya, and he arrived in May with indefatigable enthusiasm for the country's prospects as a free, Western-friendly democracy.
"The whole atmosphere has changed for the better," he wrote in an e-mail to friends and family in July. "People smile more and are much more open with foreigners. Americans, French and British are enjoying unusual popularity. Let's hope it lasts."
For those who knew him, Mr. Stevens was an easygoing, accessible, candid and at times irreverent diplomat, with a deep understanding of Arab culture and politics that began when he was a Peace Corps volunteer, teaching English in the Atlas Mountains in Morocco.
"The thing that struck me was that he had a level of candor that was unusual for a diplomat," said Sidney Kwiram, who conducted research for Human Rights Watch in Libya during the revolution and afterward and often met with him. She last spoke with him two weeks ago after her own visit to Benghazi, spending two hours on the telephone discussing t Libya's new political forces. "There was no formality to his rank," she said. "He didn't take himself too seriously, but he took his job very seriously."
He also earned bipartisan support on Capitol Hill. Senator John McCain, Republican of Arizona, recalled twice visiting him in Libya, most recently in July, when Mr. Stevens "insisted on personally making me a cappuccino, a task that he carried out with as much pride and proficiency as his diplomatic mission."
Mr. Stevens, a native of California and graduate of the University of California, Berkeley, joined the Foreign Service in 1991. He spent much of his career in the Middle East, serving in Syria, Egypt, Saudi Arabia and Israel, where he focused on the Palestinian territories, and in State Department offices overseeing policy in the region. In Syria in 2001 and 2002, he courted Iraqi exiles before the American overthrow of Saddam Hussein's government the next year. When the embassy in Damascus, Syria, held his farewell party, he insisted on it being in a disco and invited all the Iraqis, who were fractious even then. "This was probably the only time the Iraqis sat at one table - before or since," said a State Department diplomat who served with him.
His return to Libya took place in circumstances that would challenge any diplomat. Mr. Feltman said he was surprised by the network of contacts Mr. Stevens established in Benghazi in weeks, shaping the administration's understanding of the rebellion's leaders. As he prepared to take up his post as ambassador this year, Mr. Stevens appeared in an introductory video recalling the United States' Civil War as an example of overcoming strife. "We know that Libya is still recovering from an intense period of conflict," he said. "And there are many courageous Libyans who bear the scars of that battle."
He developed a reputation as a keen observer of Libya's politics, and, as Ms. Kwiram noted, a patient listener who eagerly sought out activists, diplomats and journalists. He also kept up his routine of daily runs through goat farms, olive groves and vineyards nearby.
In his e-mail to family in friends, he joked about the embassy's Fourth of July party.
"Somehow our clever staff located a Libyan band that specializes in 1980s soft rock," he wrote, "so I felt very much at home."
By Wednesday afternoon, the wall on Mr. Stevens's Facebook page had turned into a memorial as friends from high school, college, the Peace Corps and the State Department posted photos and eulogies. "In our 1983 Peace Corps training in Morocco, there was a tall, blond kid who was known, among other things, as the one with the unfailing old-school courtesy toward all," wrote Valerie Staats, who is now the Peace Corps director in Sierra Leone. Mr. Stevens, she recalled, "always said he wanted to be an ambassador, and we didn't doubt him."
Mervat Mhani, an activist for the Free Generation Movement in Libya, said that she could "no longer hold my head up high as a Libyan."