Coalition operations against the Islamic State have scored successes in Iraq and Syria, but the battle against the extremist group promises to be a “generational” one, President Obama said after military leaders briefed him on the campaign.

“This will not be quick,” Obama told reporters, referring to the group also known as ISIL or ISIS. “This is a long-term campaign. ISIL is opportunistic and it is nimble. . . . It will take time to root them out.”

Obama spoke during a rare visit to the Pentagon, where military leaders including Defense Secretary Ashton B. Carter and Gen. Martin Dempsey, chairman of the Joint Chiefs of Staff, provided an update on operations against the Islamic State.

The briefing comes a little over a year after Islamic State militants burst out of Syria and captured much of northwestern Iraq, laying bare the frailty of Iraqi security forces and the vulnerability of the Baghdad government following the U.S. military withdrawal in 2011.

Since last summer, U.S. and allied aircraft have conducted more than 5,000 strikes on Islamic State targets in both Iraq and Syria, making it harder for the militants to launch large-scale attacks.

President Obama speaks at the Pentagon with Defense Secretary Ashton Carter, left, General David Rodriguez, African Command chief, and General Martin Dempsey, chairman of the Joint Chiefs of Staff. (Drew Angerer/Bloomberg)

Obama highlighted battles in which U.S.-aligned fighters have prevailed against the group, including combat in the Syrian cities of Kobane and Tal Abyad and the Iraqi city of Tikrit. He said Islamic State fighters have lost more of than a quarter of the populated territory they had captured in Iraq.

But the group continues to control some of Iraq’s most important cities and holds sway in unpopulated areas that are more difficult for government forces to control. In May, Iraqi forces ceded the city of Ramadi to the Islamic State when they retreated en masse.

U.S. military personnel in Iraq have struggled to ensure that Iraqi forces — which remain reliant on Shiite paramilitary fighters and lack capability in key areas such as logistics, intelligence and air power — can effectively take on the Islamic State.

“As with any military effort, there will be periods of progress, but there are also going to be some setbacks,” Obama said.

Obama, who has sought to limit American involvement in overseas conflicts, said the battle would ultimately be fought by local forces, not Americans. Since last summer, Obama has sent about 3,500 U.S. advisers and trainers back to Iraq, but he has also vowed to keep American troops out of combat there.

After his discussions with defense leaders on Monday, the president said he had no immediate plans to send additional troops to Iraq.

He said the United States was now “speeding up” the training of Iraqi forces. “This aspect of our strategy was moving too slowly, but the fall of Ramadi has galvanized the Iraqi government,” he said.

American officials are also grappling with the widespread appeal of the extremist group, an al-Qaeda offshoot that has recruited fighters from around the world and has inspired attacks across the Middle East, in Europe and beyond. Most of those attacks have targeted Westerners or Shiite Muslims, whom the Islamic State considers infidels.

Other officials who attended Monday’s briefing included Gen. Lloyd Austin III, commander of U.S. Central Command; Gen. Joseph Votel, head of Special Operations Command; and, in a sign of a worrying expansion for the group in North Africa, Gen. David Rodriguez, who heads U.S. Africa Command.

Obama, who as president has paid infrequent visits to the Pentagon, last made the trip to the Defense Department in October 2014.