BEIRUT — An unexpected rebel push on Damascus has brought Syria’s civil war to the heart of its capital for the first time in years, threatening residents and serving as a reminder that the conflict is far from over.

Streets emptied and many shops and schools were closed for a third day Tuesday as battles raged on the eastern edge of the city, where the rebels launched their surprise assault over the weekend. Mortars crashed into residential neighborhoods, jets streaked overhead, and the rattle of gunfire plunged Damascus back onto the front lines of a war that has raged since 2011.

The rebel offensive seems unlikely to lead to any sustained advances into Syrian President Bashar al-Assad’s most vital and best-defended stronghold. Loyalist forces scrambled troops from other areas to defend the capital and appeared to have halted the rebel advance just beyond Abbassiyeen Square, a major gateway a few miles from the historic Old City of Damascus.

The fighting marked the first time since 2012 that rebel forces have advanced so close to the center of Damascus, highlighting the continuing fragility of Assad’s hold on power despite nearly a year and a half of steady gains – aided by Russia’s military intervention – that appeared to have won the war.

It is now becoming clear that although the rebels lack the capacity to topple Assad, Assad’s forces also lack the capacity to defeat the rebels, said Andrew J. Tabler of the Washington Institute for Near East Policy.

“This doesn’t mean the regime is going to be defeated. But their forces are just too thin,” he said. “They stand in one place, they contract in another, they shift forces to another, and this has been going on for years.”