President Trump said Thursday the U.S. would leave Syria "very soon" and "let the other people take care of it."

Trump made the announcement in an Ohio speech pushing spending on domestic infrastructure, and after heralding the Islamic State group's near-defeat.

"By the way we're knocking the hell out of ISIS. We're coming out of Syria very soon. Let the other people take care of it now — very soon, very soon, we're coming out," Trump said.

"We'll have 100 percent of the caliphate as they call it, sometimes referred to as land, we are taking it all back quickly, quickly. We're going to be coming out of there real soon, going back to our country where we belong, where we want to be," he said.

Trump's remarks echo his campaign-trail denunciations of U.S. involvement in the long-running Syrian civil war. During the campaign he frequently denounced the Obama administration's policy of arming rebels, some of them Islamist groups.

Trump's announcement comes as hundreds of U.S. troops remain embedded with a Kurdish-dominated military alliance in northern Syria and a pocket of Arab rebels in southeast Syria.

The U.S. presence in Kurdish-dominated areas has deterred military action by Turkey, which invaded a small Kurdish-controlled area of northwest Syria this year to oust U.S.-allied fighters.

The president’s talk of a quick withdrawal comes as the Pentagon admits the offensive by U.S.-backed Kurdish and Arab fighters to retake the last 2 percent of territory held by ISIS in Syria has stalled.

Kurdish military leaders and fighters who make up a large portion of the Syrian Democratic Forces have left the front lines of the battle against ISIS to fight against Turkish forces in the west.

Just hours before the president’s Ohio speech, the Pentagon said it would be staying in Syria as long as it takes.

“We will continue to support the SDF as they continue to fight against ISIS,” said Dana White, the Pentagon’s chief spokesperson. “We must not become distracted and reduce the pressure on ISIS.”

Trump’s comments also seem to contradict public statements by his defense secretary and former secretary of state.

Defense Secretary Jim Mattis has said the U.S. would not leave Syria once ISIS was defeated until there was a diplomatic solution to stabilize the country.

“We're not just going to walk away right now before the Geneva process has traction,” Mattis told reporters at the Pentagon last November. “That doesn't mean everyone stays there. We're going to make sure we set the conditions for a diplomatic solution. … Not just, you know, fight the military part of it and then say good luck on the rest of it.”

In January, then-Secretary of State Rex Tillerson made a major policy speech about Syria in which he said, “Let us be clear: The United States will maintain a military presence in Syria focused on ensuring ISIS cannot re-emerge."

Trump seemed to be rewriting that policy on the fly, the same day his new national security adviser John Bolton was having his first face-to-face meeting with Mattis at the Pentagon.

When asked to comment on the president’s Syria statements, Pentagon spokeswoman Laura Seal said, “I refer you to the White House regarding the president's comments.”

During his Ohio speech, Trump associated his position on Syria with a broader critique of the U.S. role in recent Mideast conflicts.

"Just think of it, we spent as of three months ago $7 trillion, not billion, not million, seven trillion," he said. "Nobody ever heard of the word trillion until 10 years ago, we spent $7 trillion in the Middle East. We build a school. They blow it up. We build it again they blow it up. We build it again, hasn't blown up but it will be. But if we want a school in Ohio to fix the windows, you can't get the money. If you want a school in Pennsylvania, or Iowa, to get federal money, you can't get the money. We spent $7 trillion in the Middle East and you know what we have for it? Nothing."

Trump said it was "stupid, stupid" that "we didn't keep the oil" while occupying Iraq.

