QAIM, Iraq -- From their outpost on Iraq's westernmost edge, U.S. 1st Lt. Kyle Hagerty and his troops watched civilians trickle into the area after American and Iraqi forces drove out the Islamic State group. They were, he believed, families returning to liberated homes, a hopeful sign of increasing stability.
But when he interviewed them on a recent reconnaissance patrol, he discovered he was wrong. They were families looking for shelter after being driven from their homes in a nearby town. Those who pushed them out were forces from among their "liberators" -- Shiite militiamen who seized control of the area after defeating the IS militants.
It was a bitter sign of the mixed legacy from the United States' intervention in Iraq to help defeat the militants. American-backed military firepower brought down the IS "caliphate," but many of the divisions and problems that helped fuel the extremists' rise remain unresolved.
The U.S.-led coalition, which launched its fight against IS in August 2014, is now reducing the numbers of American troops in Iraq, after Baghdad declared victory over the extremists in December. Both Iraqi and U.S. officials say the exact size of the drawdown has not yet been decided.
U.S. and Iraqi commanders here in western Iraq warn that victories over IS could be undercut easily by a large-scale withdrawal. Iraq's regular military remains dependent on U.S. support. Many within Iraq's minority communities view the U.S. presence as a buffer against the Shiite-dominated central government. Still, Iranian-backed militias with strong voices in Baghdad are pushing for a complete U.S. withdrawal, and some Iraqis liken any American presence to a form of occupation.
That has left an uncomfortable limbo in this area that was the last battlefield against the extremists. Coalition commanders still work with Iraqi forces to develop long-term plans for stability even as a draw-down goes ahead with no one certain of its eventual extent.
Hearts and Minds -- Again
"Let's go win us some hearts and minds," Sgt. Jonathan Cary, 23, joked as he and Hagerty and the patrol convoy set off from a base outside the town of Qaim, evoking a phrase used in American policy goals for Iraq ever since the 2003 U.S.-led invasion that ousted Saddam Hussein.
After just a few hours moving on foot across farmland and orchards to a cluster of modest houses, Hagerty realized the families he thought were returnees to the area were in fact newly displaced. Their homes in Qaim had been confiscated by the government-affiliated Popular Mobilization Forces, or PMF, made up mainly of Shiite paramilitary fighters backed by Iran.
"Our end goal is a stable Iraq, right?" Hagerty said later, back at the base. "But when you see stuff like that, it makes you wonder if they are ever going to be able to do it themselves."
After victories against IS, the PMF has built up a presence in many parts of Sunni-majority provinces, including western Anbar. It formally falls under the command of the prime minister, but some Iraqi commanders accuse the PMF of being a rival to government power.
PMF flags line highways crisscrossing Anbar. At a PMF checkpoint outside al-Asad airbase -- a sprawling complex used by both Iraqi and coalition forces -- U.S. convoys are regularly stopped for hours while busloads of PMF fighters are waved through.
U.S. Marine Col. Seth Folsom works closely with the branches of Iraq's security forces -- Sunni tribal fighters and the Iraqi army -- who are increasingly concerned about the rise in power of the PMF. Iran has given no indication of dialing back its support after the defeat of IS extremists.
"The biggest question I get now is, 'how long can we count on you being here?'" Folsom said of his conversations with Iraqi commanders and local politicians.
That decision ultimately rests with Iraq's political leadership, he said.
"I guess some people could see that as a cop-out, but at the same time it's not my place as a lowly colonel to define how long the U.S. presence is going to be."
'Forward Line of Freedom'
For the senior officers leading the current fight against IS, decades of U.S. military intervention in Iraq has defined their careers.
The top U.S. general in Iraq -- Lt. Gen. Paul Funk -- served in Iraq four times: in the Gulf war in 1991; in the 2003 invasion; in the surge when some 170,000 American troops were serving in Iraq in 2007; and most recently in the fight against IS.
"It will definitely be positive," Funk said of the legacy of the U.S. role against IS in Iraq. "People see their young men and women out here defeating evil. That's a positive thing."
On a recent flight from Baghdad to a small U.S. outpost in northern Syria near Manbij -- a trip that traversed the heart of the battlefield with IS for the past 3½ years -- Funk described the future of the fight as ideological and open-ended.
"The problem is people believe it's already over, and it's not," he said. "Beating the ideology, destroying the myth, that's going to take time."
Touching down outside an orchard on the perimeter of the Manbij base, Funk exclaimed: "Welcome to the front line of freedom!"
Funk predicts the ideological fight could take years and easily require U.S. troop deployments elsewhere. He said that is one reason he believes it's so important to visit U.S. troops on the current front lines -- to show them "the American people believe in their purpose."
"We have got to recruit the next generation," he said.
Many of the young U.S. troops interviewed by The Associated Press said they didn't know anything about the Islamic State group when they enlisted.
Rayden Simeona, a 21-year-old corporal in the Marines, enlisted in 2014, when all he knew about the U.S. military was from movies and video games.
"I felt like I wasn't going anywhere with my life, I had no idea what IS was. I just knew I wanted to go to war," he said. Once deployed, he said talk rarely broached the big questions of "What we are doing here?" or "Why?"
"But I do wonder all the time: Why are we spending all this money in Iraq?" he said. "There's probably some greater plan or reason that someone much higher up than me knows."
Is the Juice Worth the Squeeze?
Along Iraq's border with Syria, the two Iraqi forces charged with holding a key stretch of territory lack direct communication. Because one force falls under the Defense Ministry and the other under the Interior Ministry, their radios are incompatible.
Instead, the troops use Nokia cellphones in a part of the country where network coverage is spotty to nonexistent.
At the nearby coalition outpost near Qaim, U.S. Army Lt. Col. Brandon Payne spends much of his time filling communications gaps by relaying messages between different branches of Iraq's military.
"The coordination is not where we hoped it would be," Payne said. "But they do talk to each other, and we see that as a sign of progress."
Tactical shortcomings within Iraq's military are partially what fueled the expansion of the coalition's footprint in Iraq in the past three years. As Iraqi ground forces demonstrated an inability to communicate and coordinate attacks across multiple fronts, U.S. forces moved closer to the fighting and sped up the pace of territorial gains.
Despite the caliphate's collapse, those weaknesses have persisted. Iraqi forces remain dependent on coalition intelligence, reconnaissance, artillery fire and airstrikes to hold territory and fight IS insurgent cells.
Payne regularly shuttles between his base, Qaim and the Syrian border, meeting with different members of Iraqi forces to coordinate security and repel IS attacks from the Syrian side.
"I would say we are still needed," Payne said. "We are getting great results with this model, but you see how much goes into it."
The base, once a small, dusty outpost, now houses a few hundred coalition troops and is a maze of barracks, gyms, a dining facility, laundry services and a chapel.
"At some point, someone much higher up than me is going to decide the juice is just not worth the squeeze," Payne said, referring to the cost of such a large outpost in a remote corner of the country.
Iraqi army Lt. Col. Akram Salah Hadi, who works closely with Payne's soldiers at the Qaim outpost, said coalition training and intelligence sharing have improved the performance of his unit. But overall, the U.S. effort in Iraq gives him little hope for the future.
Corruption in the military, Hadi said, remains as bad as it was in 2014, when it was seen as a major reason why entire Iraqi divisions simply dissolved in the assault on Mosul by a few hundred IS fighters.
Young Iraqi soldiers with ambition and talent can't rise through the ranks without political connections. Top ranks are bloated with officers who have bought their promotions. Within his division alone, Hadi said he can think of 40 officers with no military background who attained their rank because of their membership in a political party.
"With leadership like this, the rest will always be rotten," he said.
Coalition programs that have trained tens of thousands of Iraqi troops have largely focused on the infantry, not the junior officers needed to lead units and instill a culture of service that will make a professional force.
Folsom, the U.S. Marine colonel, said military power will not root out corruption or heal Iraq's longstanding divisions.
"I have a saying out here," he added, "'You can't want it more than them.'"