By 1990, Iran was undergoing military rearmament and reorganization, and purchased $10 billion worth of heavy weaponry from the USSR and China, including aircraft, tanks, and missiles. Rafsanjani reversed Iran's self-imposed ban on chemical weapons, and ordered the manufacture and stockpile of them (Iran destroyed them in 1993 after ratifying the Chemical Weapons Convention). As war with the western powers loomed, Iraq became concerned about the possibility of Iran mending its relations with the west in order to attack Iraq. Iraq had lost its support from the West, and its position in Iran was increasingly untenable. Saddam realized that if Iran attempted to expel the Iraqis from the disputed territories in the border area, it was likely they would succeed. Shortly after his invasion of Kuwait, Saddam wrote a letter to Rafsanjani stating that Iraq recognised Iranian rights over the eastern half of the Shatt al-Arab, a reversion to "status quo ante bellum" that he had repudiated a decade earlier, and that he would accept Iran's demands and withdraw Iraq's military from the disputed territories. A peace agreement was signed finalizing the terms of the UN resolution, diplomatic relations were restored, and by late 1990-early 1991, the Iraqi military withdrew. The UN peacekeepers withdrew from the border shortly afterward. Most of the prisoners of war were released in 1990, although some remained as late as 2003. Iranian politicians declared it to be the "greatest victory in the history of the Islamic Republic of Iran".