Islamic State 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.

Islamic State 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 the Islamic State group 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 partially damaging two temples and famous arch.

Maamoun Abdulkarim, Syria's official for antiquities and museums, said his department had transferred the contents of Palmyra's museum to Damascus, but that he still worries about the safety of the ruins from the IS 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. IS militants later regrouped and attacked from multiple sides, forcing government troops to retreat.

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 Mayadeen news channel that the IS attack on Palmyra is 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 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 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, IS has suffered defeats in both Syria and Iraq, losing several towns and cities it had captured in 2014.

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 U.S. Defense Secretary Ash Carter at Qayara air base in Iraq.

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

A Kurdish-led Syrian force, backed by the U.S., 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 IS stronghold in northern Syria.

In going for Palmyra, IS picked a soft target to demonstrate that it retains the ability to carry out large attacks despite its battlefield losses.

Mohammed Hassan al-Homsi, who runs the Palmyra News Network, said IS was steering away from northern Syria, where Turkey and the anti-IS international 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.

Russia's Defense Ministry put some of the blame on the coalition, saying it had scaled down its operation against Raqqa and allowed thousands of IS fighters to escape Mosul. The ministry said more than 4,000 militants have been deployed for the Palmyra takeover, implying those attacking the city recently had left Mosul.

The Observatory and the Palmyra Coordination group said IS militants used a multipronged assault, forcing government forces to retreat south. A map distributed by the Observatory shows the IS-controlled areas extend east, south and north of Palmyra. They encompass a number of strategic hills around the city and expand the group's presence in rural parts of Homs province, Syria's largest, which is mostly under government control.

Osama al-Khatib of the activist-run Palmyra Coordination group, which keeps in touch with residents, said remaining government and allied troops were escaping from the southwestern edge of the city, where the ancient ruins are. The few remaining families also are trying to leave, he said.

Al-Homsi's Palmyra News Network said intense airstrikes followed the IS takeover. The group said IS fired on fleeing civilian.

In a video by the IS-linked Aamaq news agency, IS fighters were shown roaming a main square that appeared deserted below the citadel that overlooks the ruins and the Palmyra Museum.

Russia had earlier said it repelled an IS attack, launching 64 airstrikes overnight that killed 300 militants. But hours later, the activists said IS had seized a castle just outside the town that overlooks its famed Roman-era ruins.

Expelling the IS militants last year was seen as a major triumph for Assad's forces, which previously had little success against the extremists.

The government and its Russian allies have since focused on the opposition in Damascus and Aleppo. After tightening the siege on eastern Aleppo, government and allied troops have been steadily carving into the rebel-held enclave since late November.

Of the original 17 square miles of rebel-held area, only 4 square miles remain in opposition hands, Syrian media said.