Despite the recent setbacks in Iraq, the U.S. military command leading the fight against ISIS insists that its strategy is working and that the militants’ takeover of a key oil refinery and a government compound are fleeting gains feeding the militants’ propaganda machine.

"We believe across Iraq and Syria that Daesh is losing and remains on the defensive," said Marine Brig. Gen. Thomas D. Weidley, chief of staff for Combined Joint Task Force Operation Inherent Resolve, the name of the international campaign fighting the Islamic State. “Daesh” is the Arabic acronym for the group that swept into Iraq from Syria last June and quickly overran much of Iraq’s north and west.

As Weidley spoke to reporters Friday from his headquarters in Kuwait, the terror group had captured the main government compound in Ramadi, Iraqi officials said. Other officials said they had gained substantial control over the Beiji oil refinery, a strategically important prize in the battle for Iraq’s future and potential source of millions of dollars in income for the militants.

The battle to push ISIS out of the largest city in northern Iraq, Mosul, now seems more of a distant goal.

The Pentagon has insisted that it knew when it began a bombing campaign in Iraq in August 2014 that it could take years to force the Islamic State out of the country, and while the militants have conceded some ground in recent months, including the city of Tikrit, have proven remarkably resilient.

More than 3,000 U.S. troops are training and advising Iraqi forces providing protection for U.S. forces and facilities. Weidley said there is no move afoot to either expand U.S. presence or ask the White House for authority to put U.S. troops close to the front lines of combat.

The White House said Vice President Joe Biden called Iraqi Prime Minister Haider al-Abadi Friday to reaffirm U.S. support in light of the attacks on Ramadi. It said Biden promised expedited security help, including delivery of shoulder-fired rockets and other heavy weaponry to counter militant car bombs.

The State Department offered a similar assessment Friday. "There will be good days and bad days in Iraq," State Department spokesman Jeff Rathke said. "ISIL is trying to make today a bad day in Ramadi. We've said all along we see this as a long-term fight."

Weidley said Islamic State fighters had launched a complex attack Friday on Ramadi as part of an effort to "feed their information and propaganda apparatus." He said he could not confirm how much of the city had been lost or what percentage remains in Iraqi control. He said his command had seen social media postings that depict a successful Ramadi offensive.

"This is similar to the (techniques) they've used in the past where they've conducted attacks trying to gain social media gains by taking photos and documenting small-term gains and then using it for propaganda purposes," Weidley said, adding that IS was inflating the importance of its success.

"We've seen similar attacks in Ramadi over the last several months for which the ISF (Iraqi security forces) have been able to repel, and we see this one being similar to those," he said, adding that the U.S. is confident the Iraqi government will be able to take back the terrain it has lost in Ramadi.

Weidley called Ramadi a “critical city,” which appears to stand in contrast to remarks made by Gen. Martin Dempsey last month.

Dempsey said Ramadi was not central to the future of Iraq and said its potential loss “won’t be the end of the campaign” against ISIS. He also said the Beiji oil refinery, the site of fierce battles between militants and Iraqi forces, was a “more strategic” target for the terror group.

In Ramadi, Iraqi troops were forced to withdraw during an attack in which three suicide car bombs killed at least 10 people and wounded dozens more, said Mayor Dalaf al-Kubaisi. The mayor said the militants raised their black flag over the captured government compound, which houses provincial and municipal government offices.

Anbar provincial councilman Taha Abdul-Ghani said the militants killed dozens more captured security forces in the city as well as their families, without providing an exact figure. He said Iraqi and coalition warplanes were bombing the militants inside the compound.

Weidley's command said Friday in its daily summary of U.S.-led bombing in Iraq that coalition planes conducted 12 airstrikes in Iraq overnight Thursday. These included one airstrike near Ramadi that hit an IS headquarters. Four airstrikes near Beiji hit IS fighting units, destroying two fighting positions and a building, the U.S. military said.

The Associated Press contributed to this report