But less than a week earlier, Trump had embraced a almost opposite position, issuing a powerful order-against the advice of his top military and civilian advisers-to withdraw more than 2,000 USA troops from Syria within 30 days, and 7,000 from Afghanistan. A planned meeting with Iraqi Prime Minister Adil Abdul Mahdi was scrapped and replaced by a phone call, the premier's office said.
But Trump stressed during his visit that he had no intention of pulling troops out of Iraq, which he said could be used as a future base "if we wanted to do something in Syria".
'Operational security is the most important aspect of personnel deployments, ' Malcolm Nance, a former U.S. Navy intelligence specialist who has experience in Iraq, told Newsweek.
"Parliament must clearly and urgently express its view about the ongoing American violations of Iraqi sovereignty", said Salam al-Shimiri, a lawmaker loyal to the populist cleric Moqtada al-Sadr.
Both visited American troops in the country, with Obama meeting them inside a palace built by Saddam Hussein in Baghdad, while Trump visited an air base.
The Iran-backed Harakat al-Nujaba said the presence of U.S. forces in Iraq was a "violation of the country's sovereignty" and it was "now the duty of the government to expel American forces". Obama's own predecessor, President George W. Bush, had also visited Iraq less than a year after the US -led invasion of the country began in March 2003.
During the call, Trump invited Abdel Mahdi to visit Washington and he accepted, White House spokeswoman Sarah Sanders said.
Trump said it's time to leave Syria because the USA should not be involved in nation-building, and that other wealthy nations should shoulder the cost of rebuilding Syria.
In his first visit to USA troops in a conflict zone, President Donald Trump drew cheers when he told troops he won them their first raise in 10 years and suggested it was a whopping one.
If needed, the U.S. can attack ISIS "so fast and so hard" that they "won't know what the hell happened", Trump said. Let's go. Take more time.' Constantly giving them more time.
But Iran's growing influence in the country has worked to diminish pro-US sentiments and pro-Tehran groups now make up a key bloc in the Iraqi parliament. "Frankly, it's ridiculous", Trump added.
To begin with, Trump did not meet with a single Iraqi official, including Prime Minister Adel Abdul Mahdi. "First time in 10 years". You've had enough time. He defended his decision to withdraw 2,000 United States troops from neighboring Syria, saying the U.S. military had all but eliminated Isis-controlled territory there.
"In Syria, Erdogan said he wants to knock out ISIS, whatever's left, the remnants of ISIS".
The formation of Iraq's government has stalled as well, amid intensifying discord between the Islah and Bina blocs. "If - I will say this, if you take ISIS and if we see something happening with ISIS that we don't like, we can hit them so fast and so hard, they won't - they really won't know what the hell happened".
Not that IS militants have been defeated in their last urban bastions, Iraqi politicians and militia leaders are speaking out against the continued presence of USA forces on Iraqi soil.
Air Force One, lights out and window shutters drawn, flew overnight from Washington, landing at an airbase west of Baghdad in darkness Wednesday evening. "Our presence in Syria was not open-ended and was never meant to be permanent".
"It's not fair when the burden is all on us", he said.