The morning after the attack on the consulate, my colleagues and I returned to the medical center, where we witnessed an outpouring of sadness and, as one physician put it, shame. The emergency room staff members who worked to save Mr. Stevens broke down in tears, as did the physician in charge. Some knew or had met Mr. Stevens; some had not. But all were aware that he had been a champion of Libya, and of Benghazi in particular, and that his death may have rolled back Benghazi’s stupendous revolutionary accomplishments by months — even if it does not set off a period of heightened instability in eastern Libya. Many Libyans outside the hospital also offered condolences and expressed profound regret for America’s loss.

In the West, we can now expect a strong temptation among governments and private enterprise to declare the Libyan experiment a failure, and to respond by disengaging, retreating or focusing only on the extirpation of radical elements. That would be a terrible mistake. The attack has already entered into the American presidential debate in a base fashion, with Mitt Romney’s first instinct being to criticize President Obama over the timing of his denunciation of the attack. But Secretary of State Hillary Rodham Clinton got it right when she spoke of the Libyan people as allies in the fight against extremism.

The gravest mistake would be for the United States to write off Libya as an irredeemable terrorist haven, or for politicians in Washington to regret having intervened in support of Libya’s rebels. Libya is still far better off today than it was under Qaddafi. The grip of fear has been broken. Election posters festoon the country. Election schedules have been met. And there is a rich expression of individual opinions.

Nevertheless, the Libyan people need support to consolidate gains, and to continue a fight against largely foreign-financed radicals who wish to hijack the revolution in the name of intolerance. And the United States must help the Libyans do that. The loss of Ambassador Stevens will, I hope, goad the Libyan government into matching its discipline about election schedules with far bolder steps to crack down on extremists and disarm the country’s militias. And Libya should press the American government for even more support in that effort, even as it encourages American organizations to find common cause with their Libyan counterparts to improve the lives of Libya’s citizens.

This week the United States lost one of its most admirable public servants, and I can report that at least some Libyans are profoundly aware that the loss is theirs as well. As we arrived at the airport under armed escort, a member of the airport ground crew said: “Today I will go home, I will take off these clothes, and I will put on only black. As a Libyan, I am so sorry this has happened.”