BEIRUT — Syria’s government declared Thursday that it had regained full control of Aleppo after the last rebel fighters and civilians evacuated the key city as part of an agreement brokered by Russia and Turkey.

The Syrian military announced on state media that “security and stability” had been returned to eastern Aleppo, once the largest rebel stronghold. The “terrorists” – a term used by the Syrian government to describe nearly all of its opponents – had exited the city, the military said.

President Bashar Assad’s consolidation of Aleppo marks the end of the opposition presence in the city for the first time since 2012, in perhaps the most important battleground in the country’s raging civil war and a major blow to the rebellion to unseat Assad.

With crucial military and economic aid from Russia and Iran, Assad’s grip on power now looks much firmer compared with the uprising against him that erupted in 2011.

The Syrian leader and his allies are poised to consolidate their hold on areas of the country under their control and further squeeze the beleaguered rebellion elsewhere. His critics in the United States, Turkey and Saudi Arabia must increasingly grapple with a Syria, or at least major parts of it, that is now firmly under his control.

The foreign ministers of Russia, Iran and Turkey met in the Russian capital Tuesday to discuss ways to end the Syrian war, which has killed more than 400,000 people and displaced millions. On Thursday, Russia’s deputy foreign minister, Sergei Ryabkov, said in an interview with the RIA Novosti news agency that Assad’s future is “absolutely not a topic for discussion right now.”

Last week, pro-rebel residents of Aleppo began boarding buses to flee the war-ravaged eastern districts of the city as part of the Russia-Turkey deal that effectively surrendered their areas to Assad’s forces.