The withdrawal, agreed on two years ago, comes against the backdrop of the ongoing war between the United States and Iran that has also sometimes spilled over into Iraq.