WASHINGTON — Now that the military mission against the Islamic State group in the Middle East is winding down, lawmakers on Capitol Hill have shifted to the next looming fight: deciding who deserves credit for the success.

On Wednesday, members of the House Oversight and Government Reform Committee sparred over whether battlefield success against ISIS in recent months is the result of new leadership from President Donald Trump or a years-long military strategy just now coming to completion.

Defense Department officials said the extremist group has lost nearly all the territory it once held, and the military mission has shifted from liberating large swaths of Iraq and Syria to rooting out enemy fighters hiding in remote areas.

Trump has repeatedly said that his decision to boost troop numbers in the region, allow more airstrikes and special operations forces missions against ISIS strongholds, and more aggressively pursue victory have made the difference in the once-stagnant conflict.

Republicans on the oversight committee echoed those comments, attacking former President Barack Obama for micromanaging the war and failing to take the threat seriously.

“President Trump has made great strides in the fight against ISIS,” said Rep. Ron DeSantis, R-Fla., chair of the panel’s defense subcommittee. “But the American people are not seeing that story. Instead, they see nightly stories in the mainstream press about Russian interference and other issues.

“The days of feckless leadership are over … We have an administration that appreciates the danger posed by the Islamic State, and is actually playing to win.”

The hearing’s panel of witnesses included Sebastian Gorka, former deputy assistant to Trump on national security, who praised his former boss and — prompted by lawmakers — attacked Obama for “not having the will to win” during his presidency.

“The Trump administration has taken what the Obama White House called a generational threat and made it strategically irrelevant in the space of just a few months,” he said.

Democrats disputed that. They noted that the lengthy military campaign against ISIS began in October 2016, before Trump’s election. And they also credited Obama with forcing regional military leaders to accept more responsibility in the counteroffensive, after they allowed rise of the militant group in the years after the Iraq war. The overall campaign against the ISIS threat, formally known as Operation Inherent Resolve, began in October 2014.

In response, Republicans revived campaign rhetoric from last year’s presidential contest blaming Obama for the formation of ISIS and the “abandonment” of the region after the Iraq war. Democrats countered with concerns that increased airstrikes in the region under Trump have lead to a growing number of civilian deaths.

The sparring devolved into yelling when Rep. Raja Krishnamoorthi, D-Ill., questioned Gorka over past comments from Trump related to the Holocaust that he called anti-Semitic. Gorka pleaded with the subcommittee chairman to rein in Krishnamoorthi, accusing him of wandering off-topic and spreading lies.

In the middle of the exchange were outside experts who offered more moderate assessments of the progress in Iraq.

Hudson Institute fellow Michael Pregent testified that “both the Obama and Trump administrations achieved success against ISIS.” Robert Pape, a political science professor at the University of Chicago, stated the recent military progress “is not due to any one person or any one president.”

Gorka and Republican members of the committee disputed that assertion.

All the witnesses warned that the next step for the effort against ISIS is countering continued propaganda by the group which could help galvanize terrorist attacks by affiliated individuals and recruit a new wave of ISIS fighters.

“The main danger for the future is that we declare victory and walk away,” Pape said. “Without a political strategy to address Sunni disenfranchisement, a new ISIS 2.0 could emerge.”