WASHINGTON — The Pentagon and U.S. intelligence agencies view Islamic State as a shrinking and increasingly demoralized military force, a sharp shift from the seemingly invincible extremist army that declared an Islamist caliphate two years ago.

The revised assessment comes after surprisingly swift and relatively bloodless victories this summer near Syria’s border with Turkey and in the Sunni heartland of Iraq, two areas where Islamic State had appeared entrenched.

The rapid recapture last week of Jarabulus, the militants’ last garrison by the Turkish border, helped close off a boundary region that was crucial for movement of recruits, supplies and money in and out of the group’s quasi-state.

It also was the latest fight to suggest the Sunni militants no longer are willing to fight to hold territory against a sustained assault. Only one fighter was reported killed in the assault led by Turkish tanks. Several hundred others apparently fled.

Partly as a result, U.S. officials have hinted that the long-delayed assault on Mosul, Islamic State’s self-declared capital in Iraq, may be launched this fall. The city of 1 million has been increasingly cut off by advancing Iraqi and Kurdish ground forces.

Michael Knights, Iraq fellow at the nonpartisan Washington Institute for Near East Policy, said taking back Mosul, along with the Syrian towns of Deir ez Zour and Raqqah, will mark the end of the caliphate.

“After the fall of those cities, (Islamic State) will be just another terror group,” he said. “They might be able to throw a couple car bombs in city centers and mount small arms attacks, but they will no longer engage in heavy fighting on a daily basis. In other words, we’ll be back to where we were in 2013.”

Despite the optimism, U.S. intelligence officials say Islamic State’s ability to inspire or organize terrorist attacks abroad is unimpaired – and may be a bigger threat as foreign sympathizers are unable to reach the cut-off caliphate.

“Despite the progress, it is our judgment that (Islamic State’s) ability to carry out terrorist attacks … has not to date been significantly diminished,” Nicholas Rasmussen, head of the National Counterterrorism Center, told the House Homeland Security Committee recently.

Militants still detonate car bombs or launch suicide attacks nightly in Baghdad. They could devolve into the kind of sectarian insurgency that turned Iraq into a slaughterhouse after the U.S.-led invasion in 2003, or into a stateless global terrorist network like al-Qaida became after 2001.

As in other insurgencies, militants may be running away from battles now to survive and fight again – at a time and place of their choosing, experts warn. They could be sent to other battles or used as suicide bombers.

Moreover, Islamic State still has vast sway. It controls half the area it seized in Iraq in 2014 and 70 percent of its territory in Syria, according to U.S. estimates, and continues to haul in millions of dollars from taxes, fees and extortion.

Current U.S. intelligence estimates say the group now fields as few as 16,000 fighters – half its army of a year or so ago, but still a potent force.

But U.S. officials point to progress two years and more than 14,000 airstrikes after President Obama first ordered a bombing campaign against Islamic State targets.

“The number of fighters on the front line has diminished,” Lt. Gen. Sean MacFarland, commander of U.S. forces against Islamic State until last week, said in a teleconference from Baghdad. “They’ve diminished not only in quantity, but also in quality.

“All I know is when we go someplace, it’s easier to go there now than it was a year ago. And the enemy doesn’t put up as much of a fight.”