I can only speak toward American actions. The main reason the US pulled out not long after the barracks bombing was primarily due to a lack of public support for the mission in Lebanon. Americans really had no clue what American Marines were doing in some small Middle Eastern country that most had never even heard of. Reagan said the Marines were in Lebanon primarily as a peacekeeping force, although there was no peace to keep as Lebanon was in the midst of a civil war. Reagan also cast American intervention as a necessary measure to ensure that communists did not take control of the country. This reasoning was never widely accepted by the American public, and the barracks bombing, conducted by an Islamist group with no link to the Soviet Union, seemed to prove the falsity of Reagan and his administration's claims about a link between the Lebanon crisis and Soviet meddling in the Middle East.
Moreover, the American media was appalled by the actions of Israel (an American ally) in Lebanon. Often breaking cease-fire agreements and ignoring U.S. calls to stop its advance into Lebanon's capital, Beirut, the Israeli government left American media outlets grasping for a way to understand or justify Israel’s belligerence. When no understanding came, the American media put further pressure on the Reagan administration to distance itself from the Lebanon Crisis, as many believed and wrote in American editorial pages that there was a chance that Israel could end up dragging the U.S. into a regional conflict that didn't directly threaten US national interests.
In other words, there was never much public support for the American mission in Lebanon even before the barracks bombing. Americans couldn't justify US action in Lebanon on either national security or moral grounds.
Moreover, the Lebanon bombing took place just a few years after the Vietnam War had ended in disaster for the U.S., and most Americans were wary of sending American military forces abroad. Many public commentators in the US were highly critical of Reagan's use of force in Lebanon. Take, for instance, these quotes from newspaper op-eds in response to the barracks bombing:
From the New York Times:
The attack '“reveal[s] a militarized Administration, obsessed with force and more than a little trigger-happy, an Administration that has never learned that being strong is not the same as looking tough."
From Time magazine:
“Has the nation taken on worldwide commitments for the potential use of force that its military power currently is stretched too thin to fulfill?”
From Newsweek, a reporter described the bombings as:
the United States’ “face to face” encounter “with the consequences of being a superpower intent on using its military might to try to shape an unruly world.”
So to conclude, there was neither a clear moral or strategic rationale for the US mission in Lebanon which led to a fairly ambivalent, perhaps even negative, public response to the initial American mission in Lebanon. After the barracks bombing, the American public's and American media's unwillingness to engage in potentially costly regional conflicts in the years immediately following the Vietnam War made the Reagan administration's public framing of the American mission completely untenable.