Now, however, the heavy Russian support has enabled Mr. Hifter’s forces to renew their advance into the city. Over the weekend, they captured most of the neighborhood of Salah el-Deen, one of their biggest gains in months.

“The momentum has definitely shifted,” said Frederic Wehrey, a scholar at the Carnegie Endowment for International Peace who recently returned from a visit to the front. He saw signs of exhaustion among some of the city’s defenders, he said.

“If morale snaps, it is a terrifying thing," Mr. Wehrey said. “And who knows when it is going to give way?”

A collapse of the government would most likely mean a prolonged period of bloody street fighting inside the city, with years of insurgency by regional militias opposed to Mr. Hifter and now facing revenge. The turmoil would almost certainly set off new waves of internal and external migrants fleeing, analysts and diplomats say.

For Washington, Mr. Wehrey argued, allowing Russian forces to establish dominance in Libya, as they already have in Syria, would also “seriously damage whatever U.S. credibility is remaining in the Middle East.”

“Russia is basically pushing on a door that has been creaking open for a while,” he said. The United States has largely withdrawn from Libya while the European powers have been divided over how to approach it.