ISIS militants recaptured the ancient city of Palmyra from Syrian troops Sunday, according to both sides in the battle, scoring a major advance after a year of setbacks in Syria and neighboring Iraq.

In winning back Palmyra, the extremist group appeared to be taking advantage of the Syrian and Russian preoccupation with Aleppo, timing its attack to coincide with a major government offensive to capture the last remaining opposition-held neighborhoods in the northern city.

Palmyra, with its towering 2,000-year-old ruins, holds mostly symbolic meaning in the wider civil war, although its location in central Syria also gives it some strategic significance.

Related: U.S. Sending 200 Troops to Syria to Help in Fight Against ISIS in Raqqa

ISIS militants re-entered the city Saturday for the first time since they were expelled by Syrian and Russian forces amid much fanfare nine months ago. The government's first important win against ISIS in the historic city gave Damascus the chance to try to position itself as part of the global anti-terrorism campaign.

The militants had spent 10 months in Palmyra, during which they blew up a number of temples and caused other destruction — severing the heads of statues and partly damaging two temples and a famous arch.

A Syrian man carries a carpet through a devastated part of the town of Palmyra in April. Hassan Ammar / AP

Maamoun Abdulkarim, Syria's official for antiquities and museums, said that his department had transferred the contents of Palmyra's museum to Damascus but that he was still worried about the safety of the ruins from the ISIS militants.

"I fear they will be more vengeful," Abdulkarim told The Associated Press.

Palmyra was a major tourist attraction before Syria's civil war began in 2011.

Sunday's takeover came hours after government troops and Russian air raids pushed the group out the city's perimeter. ISIS militants later regrouped and attacked from multiple sides, forcing government troops to retreat.

Related: Pentagon Identifies First US Service Member Killed in Combat in Syria

The militants went door to door, looking for any remaining forces loyal to President Bashar Assad, opposition activists in the city said.

Homs provincial Gov. Talal Barazi told the pan-Arab news channel Mayadeen that the ISIS attack on Palmyra was a "desperate" reaction to the Syrian government's recent military "victories."

Scores of Syrian troops reportedly have been killed in fighting around Palmyra in recent days. While it's a distraction from the battle for Aleppo, it is unlikely to affect the government's final push on the last rebel-held neighborhoods in the northern city.

By Sunday evening, there was no sign that the army was shifting significant resources from Aleppo.

The government and its allies reportedly have mobilized some 40,000 fighters for Aleppo.

"I don't think the regime would withdraw forces from Aleppo to Palmyra and risk losing Aleppo," said Rami Abdurrahman, the head of the Syrian Observatory for Human Rights, an opposition monitoring group. "I think the regime's priority now is to finish the battle for Aleppo before the end of the month for sure. As for Palmyra, the whole international community would stand by it against IS."

In the last year, ISIS has suffered defeats in both Syria and Iraq, losing several towns and cities it had captured in 2014.

Related: Battle for Aleppo: Syrian Rebel Stronghold Set to Fall Into Assad Hands

It is now under attack in Mosul, Iraq's second-largest city and the last major urban center it controls in the country. Since the Mosul offensive began nearly two months ago, Iraqi and U.S.-led coalition forces have killed or gravely wounded more than 2,000 IS fighters, said Lt. Gen. Stephen Townsend, the top U.S. commander in Iraq. He made his remarks at a news conference with Defense Secretary Ash Carter at Qayara air base in Iraq.

On Saturday, Carter announced he is sending 200 more troops to Syria to train and advise local fighters. There are already 300 U.S. troops authorized for the Syria effort and about 5,000 in Iraq.

A Kurdish-led Syrian force, backed by the United States., is also pushing toward Raqqa, the group's de-facto capital in Syria, from the north. Meanwhile, Turkey is backing Syrian opposition fighters who have reached the outskirts of al-Bab, the ISIS stronghold in northern Syria.

In going for Palmyra, ISIS picked a soft target to demonstrate that it can still carry out large attacks despite its battlefield losses.

Mohammed Hassan al-Homsi, who runs the Palmyra News Network, said ISIS was steering away from northern Syria, where Turkey and the coalition have focused their fight. The militants are eyeing new territory, and they chose Palmyra for its desert terrain linked to Iraq and its surrounding oil and gas fields, al-Homsi said.

The state news agency SANA, quoting an unidentified military official, reported that the militant group received reinforcements from Raqqa.