THE LEBANESE and other friends of this country badly needed to be assured after the West Beirut massacre that the United States was still prepared to do its duty as a leader of the community of free nations. President Reagan provided precisely such assurance by ordering American troops, with their French and Italian comrades, back to Beirut for brief and limited peacekeeping duty only weeks after pulling them out. It may have been his most difficult foreign policy decision, but it was, we believe, necessary and right. A lesser response could have been the signal of an American retreat from responsibility. The men of violence, in Lebanon and elsewhere, would have drawn their own conclusions.

It can be said that Mr. Reagan is taking a heavy chance. So he is. Militarily, there can be no guarantee that the peacekeeping troops, notwithstanding the restricted mission assigned them, will not become engaged in battle with Lebanese desperadoes or even with elements of the armies now occupying Lebanon. Politically, the United States and its allies, just by being in Lebanon, may become responsible for further calamities, even as the Israelis became responsible for atrocities committed by others at Shatila and Sabra.

These risks, however, are not reasons for Washington to ease off its obligations. They are reasons to proceed with eyes open. Homeland defense aside, who can imagine a set of circumstances where the dispatch of troops can serve vital American interests more urgently? If not here, where?

Mr. Reagan is dispatching the Marines, moreover, in the context of an intensifying search for a broad political settlement, one covering not only Lebanon but also the larger Palestinian question to which Lebanon's crisis is intimately linked. It is precisely because of the hopes stirred by his peace proposals of Sept. 1 that Mr. Reagan can reasonably expect to win cooperation for his Lebanon venture from all the principal actors in the area. Certainly, this is true of the Arab actors.

Israel may at first take the reentry of the Marines as an implied criticism. But from an Israeli standpoint the Marines are a lot better than the likely alternatives -- sanctions on the one hand, United Nations forces on the other. Surely the Israeli government can come to see, as much of the Israeli public already does, the advantages to Israel of disentangling itself first from Beirut and then from Lebanon as a whole, as rapidly as it can.