BAGHDAD — Iraqi lawmakers are seizing on President Donald Trump's surprise visit to demand U.S. forces leave the country.

Politicians from both sides of Iraq's political divide are calling on parliament to vote to expel U.S. troops. Approximately 5,000 U.S. troops are stationed in Iraq as part of the coalition against the Islamic State group.

Trump's previously unannounced trip came at a time of change in the region following the president's announcement earlier this month that he will withdraw American troops from Syria — a heavily criticized move that prompted the resignation of Defense Secretary Jim Mattis.

Trump said on Wednesday that he had "no plans at all" to remove U.S. forces from Iraq, while defending his decision to pull them out of Syria.

"I think a lot of people are going to come around to my way of thinking. It's time for us to start using our head," Trump said.

Trump spent three hours at the U.S. air base about 100 miles west of the capital Baghdad meeting with American troops on an unannounced visit Wednesday. He left without meeting any Iraqi officials but spoke on the phone with Iraqi Prime Minister Adel Abdul-Mahdi.

Just returned from visiting our troops in Iraq and Germany. One thing is certain, we have incredible people representing our Country - people that know how to win! — Donald J. Trump (@realDonaldTrump) December 27, 2018

Foreign influence has become a hot-button issue in, Iraq in a year that saw supporters of populist cleric Moqtada al-Sadr win the largest share of votes in May elections. Al-Sadr has called for curbing U.S. and Iranian involvement in Iraqi affairs.

Lawmakers decried the visit as arrogant and a violation of Iraqi sovereignty.

"The achievements and victories achieved by Iraq, its people and its fighters will remain a great milestone dazzling the whole world and through which Iraq returned to its normal position in the region and the world," said former prime minister Haider al-Abadi in a statement.

Such actions could harm relations between the U.S. and Iraq, as well as other countries in the region, he added.

Hassan al-Kabi, the first deputy speaker of parliament, issued a statement calling for an urgent session to be held to discuss the issue.

Some parliamentarians are now raising questions about the purpose of American troops. The government needs to explain why there are "so many American troops and the nature of their work in Iraq to meet the fears and concerns of Iraqis and the future of their country," said Nuri al-Maliki, leader of the State of Law Coalition, in a statement.

The leader of an Iranian-backed Shiite militia also said the visit reflects American's attitudes toward Iraq, which he said disregards diplomatic norms and sovereignty.

"The response of Iraqis will be the decision of the parliament to force U.S. troops to leave Iraq," said Qais Khazali, the leader of the Asa'ib Ahl al-Haq, also called the Khazali Network, on Twitter.

"And if you don't do so, we have experience and capabilities to force your troops to withdraw, and your forces know these ways that forced them to withdraw in 2011," the tweet continued.

The incident marked Trump's first visit to an active combat zone since he took office.

Trump campaigned for office on a platform of ending U.S. involvement in foreign trouble spots, such as Syria, Afghanistan and Iraq.