President Donald Trump made an unannounced visit to US troops in Iraq on the day after Christmas.

It was Trump's first visit with US troops in a combat zone since taking office.

While on the ground, Trump described his reasoning for abruptly pulling US troops out of neighboring Syria.

President Donald Trump said during a surprise trip to Iraq that he had denied a request from military leaders to extend the US deployment in Syria because the Islamic militant group ISIS had been knocked "silly."

Trump arrived in Iraq for his first visit to a combat zone as president on Wednesday night, after a secretive 11-hour flight to Al Asad air base, west of Baghdad, where he addressed the more than 5,000 US troops stationed in Iraq.

After arriving just after 7:15 pm local time, Trump and first lady Melania Trump met with advisers and other officials for a briefing, after which he made remarks and took questions from reporters.

President Donald Trump and first lady Melania Trump with US troops during an unannounced visit to Al Asad Air Base in Iraq, December 26, 2018. Jonathan Ernst/REUTERS

Asked about the withdrawal from Syria, which Trump announced abruptly last week, the president said he had given "the generals" several six-month "extensions" to get out of the war-torn country.

"They said again, recently, can we have more time? I said, 'Nope.' You can’t have any more time. You’ve had enough time. We’ve knocked them out. We’ve knocked them silly," Trump said, according to a pool report.

Read more: Trump says he has 'no plans at all' to withdraw US troops from Iraq during his first visit to troops in a combat zone

Trump said the US presence in Syria was not meant to be "open-ended" and that Iraq could still be used as a base to strike the militants if needed. The US could attack ISIS "so fast and so hard" they "won't know what the hell happened," he said.

Trump campaigned on reducing the US military presence abroad, but in office he agreed to expand and extend that presence, though he had not previously discussed pulling troops from Iraq and said he had "no plans at all" to do so.

US soldiers and Iraqi Security Force artillery fire at known ISIS positions near the Iraqi-Syrian border, June 5, 2018. US Army

The sudden decision to pull some 2,000 US troops from Syria reportedly came after a conversation with Turkish President Recep Tayyip Erdogan, who questioned the US's continued presence there. (Erdogan has bristled at the US' partnership with Kurdish fighters in Syria, who Ankara views as terrorists.)

Trump's advisers, including Secretary of State Mike Pompeo and Secretary of Defense Jim Mattis, prepared talking points for him to use with Erdogan, but during the call Trump discarded them. The decision to withdraw reportedly prompted Mattis' resignation.

Read more: Even Turkey's president told Trump not to do anything hasty in Syria

"I will tell you that I’ve had some very good talks with President Erdogan who wants to knock them out also and he'll do it," Trump said, according to a pool report. "And others will do it to. Because we are in their region. They should be sharing the burden of costs and they're not."

"The United States cannot continue to be the policeman of the world," he added.

President Donald Trump and first lady Melania Trump meet with officials during an unannounced visit to Al Asad Air Base in Iraq, December 26, 2018. Jonathan Ernst/REUTERS

Earlier this week, Trump praised Saudi Arabia for committing money to help rebuild Syria, which has been riven by a seven-year-long civil war. On Wednesday, he again complimented Riyadh for its involvement.

"In Syria, Erdogan said he wants to knock out ISIS, whatever's left, the remnants of ISIS. And Saudi Arabia just came out and said they are going to pay for some economic development, which is great. That means we don't have to pay," Trump said, according to a pool report.

"We are spread out all over the world," he added. "We are in countries most people haven’t even heard about. Frankly, it's ridiculous."

After taking questions, Trump entered the base dining facility, where more than 100 service members greeted him with applause. Trump shook hands and spoke with the troops, signing several "Make America Great Again" hats and a patch with "TRUMP 2020" written on it.

At one point, after speaking with a service member, he turned to reporters and said, "He came back into the military because of me."

Turning back to the service member, Trump said: "And I am here because of you."