In a statement on Monday, the Libyan government expressed appreciation to “all countries who participated in this operation” and gave special thanks to “the United States of America and the Republic of Cyprus.”

The transitional government established in Tripoli after the fall of Col. Muammar el-Qaddafi in 2011 has suffered many humiliations, including the kidnapping of its prime minister by a small group of militiamen and the recent sacking of its Parliament by a lightly armed mob. But the loss of control of its oil revenue, despite days of bluster by the prime minister at the time, Ali Zeidan, appeared to shake the government far more seriously.

Almost as soon as the tanker reached international waters last week, the transitional Parliament voted to remove Mr. Zeidan from office, even before a consensus on who would succeed him could be reached. Parliament made the interim defense minister, Abdullah al-Thinni, the acting prime minister for a term of two weeks.

Now the American intervention has dealt a serious blow to perhaps the Libyan government’s greatest foe, Ibrahim Jathran, the 33-year-old leader of the eastern Libyan militia that blockaded the ports and tried to sell the oil.

Mr. Jathran, a former rebel who fought against Colonel Qaddafi, was initially named to lead a force protecting the oil infrastructure. He has since allied himself with the so-called federalist movement demanding more power, autonomy and oil revenue for the nation’s eastern region, which contains most of Libya’s reserves. He has refused to reopen the ports until the central government agrees to investigate allegations of corruption in its oil sales and give the east a larger cut of the proceeds.

America’s willingness to foil his illicit exports goes a long way to level the balance of power. The government in Tripoli has been unable to force Mr. Jathran to reopen the ports or allow the official sale of the oil. Now, he appears unable to sell the oil on his own, returning both sides to a stalemate — with the oil remaining in place.

Still, even as the tanker sailed back, there were reminders that the situation was not Libya’s only source of political instability. A series of car bombings on Monday at a military academy graduation ceremony in Benghazi killed at least eight people, most believed to be graduating cadets, and wounded more than a dozen, hospital and security officials said.

Islamist militants in Benghazi, who oppose federalists like Mr. Jathran, have been waging a campaign of bombings and assassinations usually aimed at former members of Qaddafi security forces. But Monday’s attack appeared to be the first time the militants have targeted recruits to Libya’s fledgling national army, cadets with no possible ties to the Qaddafi government.