The top Pentagon official has arrived in Baghdad to consult with American military commanders and Iraqi government leaders on the future U.S. troop presence.

Pat Shanahan, the acting secretary of defense, said before his unannounced arrival on Tuesday that he wanted to hear first-hand about the state of Iraq's fight against remnants of the Islamic State group.

It's Shanahan's first visit to Iraq.

The U.S. has about 5,200 troops in Iraq to train and advise Iraqi security forces, 16 years after the U.S. invaded to topple Saddam Hussein.

President Donald Trump upset Iraqis by saying earlier this month that U.S. forces should use their Iraqi positions to keep an eye on neighboring Iran. That's not the stated U.S. mission, and Iraqi officials have said Trump's proposal would violate Iraq's constitution.