WASHINGTON — American troops will remain in Syria long after their fight against the Islamic State to ensure that neither Iran nor President Bashar al-Assad of Syria take over areas that have been newly liberated with help from the United States, Secretary of State Rex W. Tillerson said on Wednesday.

Staying in Syria, Mr. Tillerson said, will help ensure that the Trump administration does not repeat what he described as the mistakes of former President Barack Obama, who withdrew troops from Iraq before the extremist threat was doused and failed to stabilize Libya after NATO airstrikes that led to the overthrow of Col. Muammar el-Qaddafi.

“We cannot allow history to repeat itself in Syria,” Mr. Tillerson said during a speech at the Hoover Institution at Stanford University near San Francisco. “ISIS has one foot in the grave, and by maintaining an American military presence in Syria until the full and complete defeat of ISIS is achieved, it will soon have two.”

ISIS is another name for the Islamic State.

There were roughly 2,000 American troops in Syria last month, a mix of engineering units that build fortifications and Special Operations units that fight and train with local militias. Additionally, American military contractors in Syria help demine recaptured areas as the Islamic State is pushed back.