Hundreds of Syrians, some snapping photographs with their cellphones, wandered down paths carved out of rubble in the old quarters of Homs on Friday, getting their first glimpse of the horrendous destruction that two years of fighting inflicted on rebel-held parts of the city.

The scenes that greeted them were devastating: city blocks pounded into an apocalyptic vista of hollow facades of blown-out buildings. Dust everywhere. Streets strewn with rebar, shattered concrete bricks, toppled telephone poles and the occasional charred, crumpled carcasses of cars.

For more than a year, President Bashar Assad’s troops blockaded these neighborhoods, pounding the rebel bastions with his artillery and air force. Under a deal struck this week, the government assumed control of the old quarters, while in return about 2,000 rebel fighters were granted safe passage to opposition areas north of Homs.

The final piece of the agreement fell into place Friday afternoon as the last 300 or so rebels left Homs after an aid convoy was allowed into two pro-government villages in northern Syria besieged by the opposition. The aid delivery was part of the Homs agreement.

The withdrawal was a major victory for the government in a conflict that has killed more than 150,000 people since March 2011. The deal handed Assad control of the city once known as “the capital of the revolution,” as well as a geographic linchpin in central Syria from which to launch offensives on rebel-held territory in the north.

Even before the last rebels departed Friday, government bulldozers were clearing paths through the heaviest rubble in Homs’ battle-scarred districts. It marked the first time government troops have entered these neighborhoods in more than a year.

Homs Gov. Talal Barazi said engineering units were combing Hamidiyeh and other parts of the old quarters in search of mines and other explosives. State TV said two soldiers were killed while dismantling a bomb.

The SANA state news agency reported that army troops discovered two field hospitals in the neighborhoods of Bab Houd and Qarabis, as well as a network of underground tunnels linking the districts to each other and to the countryside.

In Hamadiyeh, a predominantly Christian neighborhood before the fighting caused residents to flee, people trickled back in to check on their properties.

Imad Nanaa, 52, returned to examine his home for the first time in almost three years. Miraculously, he found it almost intact, compared to other houses with shattered windows and crumbling walls.

Speaking nervously and hurriedly because he wanted to leave as quickly as possible, Nanaa said he was looking forward to coming back with his family as soon as the army allowed it.

“This deal has saved us from more blood and destruction,” he said.

Back in Hamadiyeh, the historic St. Mary Church of the Holy Belt was heavily damaged, although the thick stone walls were still standing. There were no pews and some of the icons were disfigured. The Syriac Orthodox church’s damaged bell lolled on the ground in the courtyard.

The Greek Orthodox bishop in Homs, George Abu Zakhm, said the situation there is “catastrophic.” He said all 11 churches in Homs’ old quarter have been either heavily damaged or destroyed.