Washington (CNN) Secretary of Defense Mark Esper said Monday that some US troops will temporarily remain in Syria in part to protect oil fields in the country from ISIS as other US troops withdraw from northern Syria.

Speaking at a press conference in Afghanistan, Esper said the US withdrawal from northern Syria will take "weeks not days" and that troops temporarily staying near oil fields are not in the current phase of withdrawal of troops from northern Syria.

"Our forces will remain in the towns that are located near to the oil fields," Esper said. "A purpose of those forces working with the (Kurdish-led Syrian Democratic Forces) is to deny access to those oil fields by ISIS and others who may benefit from their revenues earned."

A US official told CNN up to several hundred troops may stay in eastern Syria to protect the oil fields and continue the fight against ISIS. The US military is "providing options and contingency plans to give (President Donald Trump) options," the official said, although orders "have not been given yet."

On Twitter, Trump has repeatedly mentioned securing oil in Syria in recent days.

Read More