By 1986, Haftar had attained the rank of colonel, and was then the chief officer in command of Gaddafi's military forces in Chad in the Chadian–Libyan conflict. During the war, in which the Libyan forces were either captured or driven back across the border, Haftar and 600–700 of his men were captured as prisoners of war, and incarcerated in 1987 after their defeat in the Ouadi Doum air raid. Shortly after this disastrous battle, Gaddafi disavowed Haftar and the other Libyan prisoners of war who were captured by Chad. One possible contributing factor to Gaddafi's repudiation of Haftar and of other captured prisoners of war may have been the fact that Gaddafi had earlier signed an agreement to withdraw all Libyan forces from Chad, and Haftar's operations inside of Chad had been in violation of this agreement. Another possible reason given for Gaddafi's abandonment of Haftar was the potential that Haftar might return to Libya as a hero and thus pose a threat to Gaddafi's rule itself. In any event, Gaddafi's repudiation clearly served to embitter Haftar towards Gaddafi.