The move brings to a close more than two decades of American military presence in the western part of the country.