Troops may remain in Afghanistan beyond war: Obama