MAKHMOUR, Iraq — Just months after the Islamic State militant group lost the last of its territory in Syria, and days after its leader, Abu Bakr al-Baghdadi, was killed in a U.S.-led raid, the group has found safe haven in a remote, ungoverned space in Iraq, as foreign fighters move across the border from Syria, military officials tell NBC news.

U.S. Marine Corps Brig. Gen. William Seely. NBC News

"The fight against ISIS is continuous," said U.S. Marine Corps Brig. Gen. William Seely, commander of Task Force-Iraq. "We're seeing ISIS fighters move from Syria across hundreds of miles of desert."

Their goal, Seely says, is to re-establish their physical caliphate in the region.

In 2014, ISIS controlled vast areas of land across Syria and Iraq, with more than 34,000 square miles and 10 million people living under its control, in what the group referred to as its caliphate. U.S.-backed fighters in Syria declared victory over ISIS in March, and amid Turkey's invasion into northeast Syria last month, President Donald Trump tweeted that the U.S. had defeated "100% of the ISIS Caliphate."

But in its most recent quarterly annual report on U.S. operations in Syria, released in August, the Defense Department's inspector general said that "ISIS remains a threat in Iraq and Syria." Former Defense Secretary James Mattis has also warned that the president's decision to pull troops from Syria's border in advance of a Turkish incursion could lead to ISIS's resurgence.

Now, military officials on the ground say it's already happening. ISIS has moved into a valley in a remote mountainous region in Northern Iraq. The valley is controlled by the Kurdish peshmerga on one side and the Iraqi army on the other. But along the dividing line between the two, there are areas — some as wide as five miles — where neither side patrols, giving the militants space to move.

And they do, coming out mainly at night.

"They have some tunnels, they have some caves," said Gen. Sirwan Barzani, the commander of the Kurdish peshmerga forces, at a remote outpost atop a mountain in Makhmour that overlooks the valley. "And they are moving — especially at night."

Barzani said he and his troops can see them moving, riding motorcycles, driving pickup trucks — even on foot. And while the sparse local population may not welcome the ISIS fighters, they aren't given a choice.

"They'll come out of that area at night, let's say, and go down to a city or a farm or village and shake down the whole population and extract resources," said Maj. Gen. Alexus Grynkewich, deputy commander of Combined Joint Task Force Operation Inherent Resolve, a U.S.-led military operation dedicated to defeating ISIS in Iraq and Syria.

"I think it's the place where they have the designs to re-establish the physical caliphate and if they could, I think they would do it here. Syria in my mind is more of a support zone for them," he added.

Right now, the number of ISIS fighters in the region is not large — estimated to only number a couple hundred, according to Kurdish officials. But that is how ISIS and its caliphate began: small groups of determined fighters taking over land and imposing their rule.

Barzani, the Kurdish commander, sees history repeating itself. "You can say they are [in] exactly the same situation of ISIS in 2012 in Iraq," he said. "It's the same situation there now. They are starting to reorganize themselves."