The most important dispute was over the Shatt al-Arab waterway. Iran repudiated the demarcation line established in the Anglo-Ottoman Convention of Constantinople of November 1913. Iran asked the border to run along the thalweg, the deepest point of the navigable channel.

Finally in 1937 Iran and Iraq signed their first boundary treaty. The treaty established the waterway border on the eastern bank of the river except for a four-mile anchorage zone near Abadan, which was allotted to Iran and where the border ran along the thalweg.

Iran sent a delegation to Iraq soon after the Ba'ath coup in 1969 and, when Iraq refused to proceed with negotiations over a new treaty, the treaty of 1937 was withdrawn by Iran.

Ayatollah Ruhollah Khomeini called on Iraqis to overthrow the Ba'ath government, which was received with considerable anger in Baghdad. On 17 July 1979, despite Khomeini's call, Saddam gave a speech praising the Iranian Revolution and called for an Iraqi-Iranian friendship based on non-interference in each other's internal affairs. When Khomeini rejected Saddam's overture by calling for Islamic revolution in Iraq, Saddam was alarmed.

on 17 September 1980, Iraq suddenly abrogated the Algiers Protocol following the Iranian revolution. Saddam Hussein claimed that the Islamic Republic of Iran refused to abide by the stipulations of the Algiers Protocol and, therefore, Iraq considered the Protocol null and void. Five days later, the Iraqi army crossed the border.

On 22 September, a prolonged battle began in the city of Khorramshahr, eventually leaving 7,000 dead on each side. Reflecting the bloody nature of the struggle, Iranians came to call Khorramshahr "City of Blood".

Iraq launched a full-scale invasion of Iran on 22 September 1980. The Iraqi Air Force launched surprise air strikes on ten Iranian airfields with the objective of destroying the Iranian Air Force. The attack failed to damage the Iranian Air Force significantly; it damaged some of Iran's airbase infrastructure, but failed to destroy a significant number of aircraft.

The next day, Iraq launched a ground invasion along a front measuring 644 km (400 mi) in three simultaneous attacks. The invasion's purpose, according to Saddam, was to blunt the edge of Khomeini's movement and to thwart his attempts to export his Islamic revolution to Iraq and the Persian Gulf states.

Though the Iraqi air invasion surprised the Iranians, the Iranian air force retaliated the day after with a large-scale attack against Iraqi air bases and infrastructure in Operation Kaman 99. Groups of F-4 Phantom and F-5 Tiger fighter jets attacked targets throughout Iraq, such as oil facilities, dams, petrochemical plants, and oil refineries, and included Mosul Airbase, Baghdad, and the Kirkuk oil refinery.

On 24 September, the Iranian Navy attacked Basra, Iraq, destroying two oil terminals near the Iraqi port Faw, which reduced Iraq's ability to export oil. The Iranian ground forces (primarily consisting of the Revolutionary Guard) retreated to the cities, where they set up defences against the invaders.

By 30 September, the Iraqis had managed to clear the Iranians from the outskirts of the city. The next day, the Iraqis launched infantry and armoured attacks into the city. After heavy house-to-house fighting, the Iraqis were repelled.

On 30 September, Iran's air force launched Operation Scorch Sword, striking and badly damaging the nearly-complete Osirak nuclear reactor near Baghdad.

By 1 October, Baghdad had been subjected to eight air attacks. In response, Iraq launched aerial strikes against Iranian targets.

On 14 October, the Iraqis launched a second offensive. The Iranians launched a controlled withdrawal from the city, street by street.

In November, Saddam ordered his forces to advance towards Dezful and Ahvaz, and lay sieges to both cities. However, the Iraqi offensive had been badly damaged by Iranian militias and air power. Iran's air force had destroyed Iraq's army supply depots and fuel supplies, and was strangling the country through an aerial siege.

By 24 October, most of the city was captured, and the Iranians evacuated across the Karun River. Some partisans remained, and fighting continued until 10 November.

On 28 November, Iran launched Operation Morvarid (Pearl), a combined air and sea attack which destroyed 80% of Iraq's navy and all of its radar sites in the southern portion of the country.

On 7 December, Hussein announced that Iraq was going on the defensive. By the end of 1980, Iraq had destroyed about 500 Western-built Iranian tanks and captured 100 others.

On 5 January 1981, Iran had reorganised its forces enough to launch a large-scale offensive, Operation Nasr (Victory).

In Battle of Dezful, the Iranian armoured divisions were nearly wiped out in one of the biggest tank battles of the war. When the Iranian tanks tried to manoeuvre, they became stuck in the mud of the marshes, and many tanks were abandoned. The Iraqis lost 45 T-55 and T-62 tanks, while the Iranians lost 100–200 Chieftain and M-60 tanks. Reporters counted roughly 150 destroyed or deserted Iranian tanks , and also 40 Iraqi tanks. 141 Iranians were killed during the battle.

The Iraqi Air Force, badly damaged by the Iranians, was moved to the H-3 Airbase in Western Iraq, near the Jordanian border and away from Iran. However, on 3 April 1981, the Iranian air force used eight F-4 Phantom fighter bombers, four F-14 Tomcats, three Boeing 707 refuelling tankers, and one Boeing 747 command plane to launch a surprise attack on H3, destroying 27–50 Iraqi fighter jets and bombers.

By late 1981 , Iran returned to the offensive and launched a new operation (Operation Samen-ol-A'emeh (The Eighth Imam)), ending the Iraqi Siege of Abadan on 27–29 September 1981.

On 15 October, after breaking the siege, a large Iranian convoy was ambushed by Iraqi tanks, and during the ensuing tank battle Iran lost 20 Chieftains and other armored vehicles and withdrew from the previously gained territory.

On 29 November 1981, Iran began Operation Tariq al-Qods with three army brigades and seven Revolutionary Guard brigades.

The Iraqis failed to properly patrol their occupied areas , and the Iranians constructed a 14 km (14,000 m; 8.7 mi) road through the unguarded sand dunes, launching their attack from the Iraqi rear. The town of Bostan was retaken from Iraqi divisions by 7 December.

At a cabinet meeting in Baghdad, Minister of Health Riyadh Ibrahim Hussein suggested that Saddam could step down temporarily as a way of easing Iran towards a ceasefire, and then afterwards would come back to power. Saddam, annoyed, asked if anyone else in the Cabinet agreed with the Health Minister's idea. When no one raised their hand in support, he escorted Riyadh Hussein to the next room, closed the door, and shot him with his pistol. Saddam returned to the room and continued with his meeting.

The Iraqis, realising that the Iranians were planning to attack, decided to preempt them with Operation al-Fawz al-'Azim (Supreme Success) on 19 March. Using a large number of tanks, helicopters, and fighter jets, they attacked the Iranian buildup around the Roghabiyeh pass. Though Saddam and his generals assumed they had succeeded, in reality the Iranian forces remained fully intact.

Iran's next major offensive, led by then Colonel Ali Sayad Shirazi , was Operation Fath-ol-Mobeen (Undeniable Victory). On 22 March 1982, Iran launched an attack which took the Iraqi forces by surprise: using Chinook helicopters, they landed behind Iraqi lines, silenced their artillery, and captured an Iraqi headquarters. The Iranian Basij then launched "human wave" attacks, consisting of 1,000 fighters per wave. Though they took heavy losses, they eventually broke through Iraqi lines. Operation Undeniable Victory was an Iranian victory; Iraqi forces were driven away from Shush, Dezful and Ahvaz. The Iranian armed forces destroyed 320–400 Iraqi tanks and armored vehicles in a costly success.

In April 1982, the rival Ba'athist regime in Syria, one of the few nations that supported Iran, closed the Kirkuk-Baniyas pipeline that had allowed Iraqi oil to reach tankers on the Mediterranean, reducing the Iraqi budget by $ 5 billion per month. But Saudi Arabia, Kuwait, and the other Gulf states saved Iraq from bankruptcy.

In preparation for Operation Beit ol-Moqaddas, the Iranians had launched numerous air raids against Iraq air bases, destroying 47 jets (including Iraq's brand new Mirage F-1 fighter jets from France); this gave the Iranians air superiority over the battlefield while allowing them to monitor Iraqi troop movements.

On 29 April, Iran launched the offensive. 70,000 Revolutionary Guard and Basij members struck on several axes – Bostan, Susangerd, the west bank of the Karun River, and Ahvaz. The Basij launched human wave attacks, which were followed up by the regular army and Revolutionary Guard support along with tanks and helicopters.

Under heavy Iranian pressure, the Iraqi forces retreated. By 12 May, Iran had driven out all Iraqi forces from the Susangerd area.

In the early morning hours of 23 May 1982, the Iranians began the drive towards Khorramshahr across the Karun River. This part of Operation Beit ol-Moqaddas was spearheaded by the 77th Khorasan division with tanks along with the Revolutionary Guard and Basij.

The Iranians hit the Iraqis with destructive air strikes and massive artillery barrages, crossed the Karun River, captured bridgeheads, and launched human wave attacks towards the city. Saddam's defensive barricade collapsed; in less than 48 hours of fighting, the city fell and 19,000 Iraqis surrendered to the Iranians.

A defector who flew his MiG-21 to Syria in June 1982 revealed that the Iraqi Air Force had only three squadrons of fighter-bombers left that were capable of mounting offensive operations into Iran. The Iraqi Army Air Corps was in slightly better shape, and could still operate more than 70 helicopters.

With Iranian success on the battlefield, the United States increased its support of the Iraqi government, President Ronald Reagan decided that the United States "could not afford to allow Iraq to lose the war to Iran", and that the United States "would do whatever was necessary to prevent Iraq from losing". Reagan formalized this policy by issuing a National Security Decision Directive to this effect in June 1982, and removed Iraq from the list of countries "supporting terrorism" and sold weapons such as howitzers to Iraq via Jordan.

On June 20, 1982, Saddam announced that he wanted to sue for peace and proposed an immediate ceasefire and withdrawal from Iranian territory within two weeks. Khomeini responded by saying the war would not end until a new government was installed in Iraq and reparations paid. He proclaimed that Iran would invade Iraq and would not stop until the Ba'ath regime was replaced by an Islamic republic.

The Iranians planned their attack in southern Iraq, near Basra. Called Operation Ramadan, it involved over 180,000 troops from both sides, and was one of the largest land battles since World War II.

On 16 July, Iran tried again further north and managed to push the Iraqis back. However, only 13 km (8.1 mi) from Basra, the poorly equipped Iranian forces were surrounded on three sides by Iraqis with heavy weaponry. Some were captured, while many were killed. Only a last-minute attack by Iranian AH-1 Cobra helicopters stopped the Iraqis from routing the Iranians.They were successful in defeating the Iranian breakthroughs, but suffered heavy losses.

After Iran's failure in Operation Ramadan, they carried out only a few smaller attacks. During Operation Muslim ibn Aqil (1–7 October), Iran recovered 150 km2 (58 sq mi) of disputed territory straddling the international border and reached the outskirts of Mandali before being stopped by Iraqi helicopter and armoured attacks.

During Operation Muharram (1–21 November), the Iranians captured part of the Bayat oilfield with the help of their fighter jets and helicopters, destroying 105 Iraqi tanks, 70 APCs, and 7 planes with few losses. They nearly breached the Iraqi lines but failed to capture Mandali after the Iraqis sent reinforcements.

In Operation Fajr al-Nasr (Before the Dawn/Dawn of Victory), launched 6 February 1983, the Iranians shifted focus from the southern to the central and northern sectors. Employing 200,000 "last reserve" Revolutionary Guard troops, Iran attacked along a 40 km (25 mi) stretch near al-Amarah, Iraq, about 200 km (120 mi) southeast of Baghdad, in an attempt to reach the highways connecting northern and southern Iraq. The attack was stalled by 60 km (37 mi) of hilly escarpments, forests, and river torrents blanketing the way to al-Amarah, but the Iraqis could not force the Iranians back. Iran directed artillery on Basra, Al Amarah, and Mandali.

By 27 February, they had captured the island, but suffered catastrophic helicopter losses to IRAF. On that day, a massive array of Iranian helicopters transporting Pasdaran troops were intercepted by Iraqi combat aircraft (MiGs, Mirages and Sukhois).

From early 1983–1984, Iran launched a series of four Valfajr (Dawn) Operations (that eventually numbered to 10). During Operation Dawn-1, in early February 1983, 50,000 Iranian forces attacked westward from Dezful and were confronted by 55,000 Iraqi forces. The Iranian objective was to cut off the road from Basra to Baghdad in the central sector. **place needs to be revised

During Operation Dawn-2, the Iranians directed insurgency operations by proxy in April 1983 by supporting the Kurds in the north. With Kurdish support, the Iranians attacked on 23 July 1983, capturing the Iraqi town of Haj Omran and maintaining it against an Iraqi poison gas counteroffensive. This operation incited Iraq to later conduct indiscriminate chemical attacks against the Kurds.

The Iranians attempted to further exploit activities in the north on 30 July 1983, during Operation Dawn-3. Iran saw an opportunity to sweep away Iraqi forces controlling the roads between the Iranian mountain border towns of Mehran, Dehloran and Elam. Iraq launched airstrikes, and equipped attack helicopters with chemical warheads; while ineffective, it demonstrated both the Iraqi general staff's and Saddam's increasing interest in using chemical weapons. In the end, 17,000 had been killed on both sides, with no gain for either country.

The focus of Operation Dawn-4 in September 1983 was the northern sector in Iranian Kurdistan. Three Iranian regular divisions, the Revolutionary Guard, and Kurdistan Democratic Party (KDP) elements amassed in Marivan and Sardasht in a move to threaten the major Iraqi city Suleimaniyah. Iran's strategy was to press Kurdish tribes to occupy the Banjuin Valley, which was within 45 km (28 mi) of Suleimaniyah and 140 km (87 mi) from the oilfields of Kirkuk. To stem the tide, Iraq deployed Mi-8 attack helicopters equipped with chemical weapons and executed 120 sorties against the Iranian force, which stopped them 15 km (9.3 mi) into Iraqi territory. 5,000 Iranians and 2,500 Iraqis died.

The so-called "Tanker War" started when Iraq attacked the oil terminal and oil tankers at Kharg Island in early 1984. Iraq's aim in attacking Iranian shipping was to provoke the Iranians to retaliate with extreme measures, such as closing the Strait of Hormuz to all maritime traffic, thereby bringing American intervention; the United States had threatened several times to intervene if the Strait of Hormuz were closed.

On 7 February 1984, during the first war of the cities, Saddam ordered his air force to attack eleven Iranian cities.

The cities bombardments ceased on 22 February 1984. Though Saddam had aimed for the attacks to demoralise Iran and force them to negotiate, they had little effect, and Iran quickly repaired the damage.

Operation Kheibar began on 24 February with Iranian infantrymen crossing the Hawizeh Marshes using motorboats and transport helicopters in an amphibious assault. The Iranians attacked the vital oil-producing Majnoon Island by landing troops via helicopters onto the islands and severing the communication lines between Amareh and Basra. They then continued the attack towards Qurna.

By 29 February, the Iranians had reached the outskirts of Qurna and were closing in on the Baghdad–Basra highway. They had broken out of the marshes and returned to open terrain, where they were confronted by conventional Iraqi weapons, including artillery, tanks, air power, and mustard gas. 1,200 Iranian soldiers were killed in the counter-attack. The Iranians retreated back to the marshes, though they still held onto them along with Majnoon Island.

Iraq repeatedly bombed Iran's main oil export facility on Kharg Island, causing increasingly heavy damage. As a first response to these attacks, Iran attacked a Kuwaiti tanker carrying Iraqi oil near Bahrain on 13 May 1984, as well as a Saudi tanker in Saudi waters on 16 May.

Attacks on ships of noncombatant nations in the Persian Gulf sharply increased thereafter, with both nations attacking oil tankers and merchant ships of neutral nations in an effort to deprive their opponent of trade. The Iranian attacks against Saudi shipping led to Saudi F-15s shooting down a pair of F-4 Phantom II on 5 June 1984.

Iran launched (Dawn 7) took place from 18–25 October 1984, when they recaptured the Iranian city of Mehran, which had been occupied by the Iraqis from the beginning of the war.

The Iraqis attacked again on 28 January 1985; they were defeated, and the Iranians retaliated on 11 March 1985 with a major offensive directed against the Baghdad-Basra highway (one of the few major offensives conducted in 1985), codenamed Operation Badr (after the Battle of Badr, Muhammad's first military victory in Mecca).

The ferocity of the Iranian offensive broke through the Iraqi lines. The Revolutionary Guard, with the support of tanks and artillery, broke through north of Qurna on 14 March. That same night 3,000 Iranian troops reached and crossed the Tigris River using pontoon bridges and captured part of the Baghdad–Basra Highway 6, which they had failed to achieve in Operations Dawn 5 and 6.

Saddam responded by launching chemical attacks against the Iranian positions along the highway and by initiating the second "war of the cities", with an air and missile campaign against twenty to thirty Iranian population centers, including Tehran.

Because the Iranian war effort relied on popular mobilization, their military strength actually declined, and Iran was unable to launch any major offensives after Karbala-5. As a result, for the first time since 1982, the momentum of the fighting shifted towards the regular army. Since the regular army was conscription based, it made the war even less popular. Many Iranians began to try to escape the conflict. As early as May 1985, anti-war demonstrations took place in 74 cities throughout Iran, which were crushed by the regime, resulting in some protesters being shot and killed.

On 6 January 1986, the Iraqis launched an offensive attempting to retake Majnoon Island. However, they were quickly bogged down into a stalemate against 200,000 Iranian infantrymen, reinforced by amphibious divisions. However, they managed to gain a foothold in the southern part of the island.

On the night of 10–11 February 1986, the Iranians launched Operation Dawn 8, in which 30,000 troops comprising five Army divisions and men from the Revolutionary Guard and Basij advanced in a two-pronged offensive to capture the al-Faw peninsula in southern Iraq, the only area touching the Persian Gulf. The capture of Al Faw and Umm Qasr was a major goal for Iran.

The sudden capture of al-Faw took the Iraqis by shock, since they had thought it impossible for the Iranians to cross the Shatt al-Arab. On 12 February 1986, the Iraqis began a counter-offensive to retake al-Faw, which failed after a week of heavy fighting.

On 24 February 1986, Saddam sent one of his best commanders, General Maher Abd al-Rashid, and the Republican Guard to begin a new offensive to recapture al-Faw. A new round of heavy fighting took place. However, their attempts again ended in failure, costing them many tanks and aircraft: their 15th mechanised division was almost completely wiped out.

In March 1986, the Iranians tried to follow up their success by attempting to take Umm Qasr, which would have completely severed Iraq from the Gulf and placed Iranian troops on the border with Kuwait. However, the offensive failed due to Iranian shortages of armor.

In April 1986, Ayatollah Khomeini issued a fatwa declaring that the war must be won by March 1987. The Iranians increased recruitment efforts, obtaining 650,000 volunteers. The animosity between the Army and the Revolutionary Guard arose again, with the Army wanting to use more refined, limited military attacks while the Revolutionary Guard wanted to carry out major offensives. Iran, confident in its successes, began planning their largest offensives of the war, which they called their "final offensives."

On 15–19 May, Iraqi Army's Second Corps, supported by helicopter gunships, attacked and captured the city of Mehran. Saddam then offered the Iranians to exchange Mehran for al-Faw. The Iranians rejected the offer. Iraq then continued the attack, attempting to push deeper into Iran. However, Iraq's attack was quickly warded off by Iranian AH-1 Cobra helicopters with TOW missiles, which destroyed numerous Iraqi tanks and vehicles.

The Iranians built up their forces on the heights surrounding Mehran. On 30 June, using mountain warfare tactics they launched their attack.

Iran Succeeded To recaptur The city of Muhran by 3 July 1986.

Saddam ordered the Republican Guard to retake the city on 4 July, but their attack was ineffective. Iraqi losses were heavy enough to allow the Iranians to also capture territory inside Iraq, and depleted the Iraqi military enough to prevent them from launching a major offensive for the next two years.

On 25 December 1986, Iran launched Operation Karbala-4 (Karbala referring to Hussein ibn Ali's Battle of Karbala). According to Iraqi General Ra'ad al-Hamdani, this was a diversionary attack. The Iranians launched an amphibious assault against the Iraqi island of Umm al-Rassas in the Shatt-Al-Arab river, parallel to Khoramshahr. They then set up a pontoon bridge and continued the attack, eventually capturing the island in a costly success but failing to advance further; the Iranians had 60,000 casualties, while the Iraqis 9,500.

At the same time as Operation Karbala 5, Iran also launched Operation Karbala-6 against the Iraqis in Qasr-e Shirin in central Iran to prevent the Iraqis from rapidly transferring units down to defend against the Karbala-5 attack. The attack was carried out by Basij infantry and the Revolutionary Guard's 31st Ashura and the Army's 77th Khorasan armored divisions. The Basij attacked the Iraqi lines, forcing the Iraqi infantry to retreat. An Iraqi armored counter-attack surrounded the Basij in a pincer movement, but the Iranian tank divisions attacked, breaking the encirclement. The Iranian attack was finally stopped by mass Iraqi chemical weapons attacks.

The Siege of Basra, code-named Operation Karbala-5, was an offensive operation carried out by Iran in an effort to capture the Iraqi port city of Basra in early 1987. This battle, known for its extensive casualties and ferocious conditions, was the biggest battle of the war and proved to be the beginning of the end of the Iran–Iraq War. While Iranian forces crossed the border and captured east part of Basra Governorate, the operation ended in a stalemate.

During Operation Nasr-4, the Iranians surrounded the city of Suleimaniya and with the help of the Peshmerga infiltrated over 140 km into Iraq and raided and threatened to capture the oil-rich city of Kirkuk and other northern oilfields. Nasr-4 was considered to be Iran's most successful individual operation of the war but Iranian forces were unable to consolidate their gains and continue their advance; while these offensives coupled with the Kurdish uprising sapped Iraqi strength, losses in the north would not mean a catastrophic failure for Iraq.

A U.S. Navy ship, Stark, was struck on 17 May 1987 by two Exocet anti-ship missiles fired from an Iraqi F-1 Mirage plane. The missiles had been fired at about the time the plane was given a routine radio warning by Stark. The frigate did not detect the missiles with radar, and warning was given by the lookout only moments before they struck. Both missiles hit the ship, and one exploded in crew quarters, killing 37 sailors and wounding 21.

On 28 June, Iraqi fighter bombers attacked the Iranian town of Sardasht near the border, using chemical mustard gas bombs. While many towns and cities had been bombed before, and troops attacked with gas, this was the first time that the Iraqis had attacked a civilian area with poison gas. One quarter of the town's then population of 20,000 was burned and stricken, and 113 were killed immediately, with many more dying and suffering health effects over the next decades.

On 20 July, the UN Security Council passed the U.S.-sponsored Resolution 598, which called for an end to the fighting and a return to pre-war boundaries. This resolution was noted by Iran for being the first resolution to call for a return to the pre-war borders, and setting up a commission to determine the aggressor and compensation.

The attacks on oil tankers continued. Both Iran and Iraq carried out frequent attacks during the first four months of the year. Iran was effectively waging a naval guerilla war with its IRGC navy speedboats, while Iraq attacked with its aircraft. In 1987, Kuwait asked to reflag its tankers to the U.S. flag. They did so in March, and the U.S. Navy began Operation Earnest Will to escort the tankers. The result of Earnest Will would be that while oil tankers shipping Iraqi/Kuwaiti oil were protected, Iranian tankers and neutral tankers shipping to Iran would be unprotected, resulting in both losses for Iran and the undermining of its trade with foreign countries, damaging Iran's economy further.

On 24 September, US Navy SEALS captured the Iranian mine-laying ship Iran Ajr, a diplomatic disaster for the already isolated Iranians.

Iran deployed Silkworm missiles to attack some ships, but only a few were actually fired, and in response to Iranian Silkworm missile attacks on Kuwaiti oil tankers, launched Operation Nimble Archer, destroying two Iranian oil rigs in the Persian Gulf.

On 17 April 1988, Iraq launched Operation Ramadan Mubarak (Blessed Ramadan), a surprise attack against the 15,000 Basij troops on the peninsula, and within 48 hours, all of the Iranian forces had been killed or cleared from the al-Faw Peninsula.

The same day as Iraq's attack on al-Faw peninsula, the United States Navy launched Operation Praying Mantis in retaliation against Iran for damaging a warship with a mine. Iran lost oil platforms, destroyers, and frigates in this battle, which ended only when President Reagan decided that the Iranian navy had been put down enough.

On 25 May 1988, Iraq launched the first of five Tawakalna ala Allah (Trust in God) Operations, consisting of one of the largest artillery barrages in history, coupled with chemical weapons. The marshes had been dried by drought, allowing the Iraqis to use tanks to bypass Iranian field fortifications, expelling the Iranians from the border town of Shalamcheh after less than 10 hours of combat.

Faced with such losses, Khomeini appointed the cleric Hashemi Rafsanjani as the Supreme Commander of the Armed Forces, though he had in actuality occupied that position for months. Rafsanjani ordered a last desperate counter-attack into Iraq, which was launched 13 June 1988. The Iranians infiltrated through the Iraqi trenches and moved 10 km (6.2 mi) into Iraq and managed to strike Saddam's presidential palace in Baghdad using fighter aircraft. After three days of fighting, the decimated Iranians were driven back to their original positions again.

On 18 June, Iraq launched Operation Forty Stars in conjunction to the Mujahideen-e-Khalq (MEK) around Mehran. With 530 aircraft sorties and heavy use of nerve gas, they crushed the Iranian forces in the area, killing 3,500 and nearly destroying a Revolutionary Guard division. Mehran was captured once again and occupied by the MEK. Iraq also launched air raids on Iranian population centers and economic targets, setting 10 oil installations on fire.

On 25 June, Iraq launched the second Tawakal ala Allah operation against the Iranians on Majnoon Island. Iraqi commandos used amphibious craft to block the Iranian rear, then used hundreds of tanks with massed conventional and chemical artillery barrages to recapture the island after 8 hours of combat.

On 2 July, Iran belatedly set up a joint central command which unified the Revolutionary Guard, Army, and Kurdish rebels, and dispelled the rivalry between the Army and the Revolutionary Guard.

the USS Vincennes shot down Iran Air Flight 655, killing 290 passengers and crew. The lack of international sympathy disturbed the Iranian leadership, and they came to the conclusion that the United States was on the verge of waging a full-scale war against them, and that Iraq was on the verge of unleashing its entire chemical arsenal upon their cities.

By 12 July, the Iraqis had captured the city of Dehloran, 30 km (19 mi) inside Iran, along with 2,500 troops and much armour and material, which took four days to transport to Iraq. The Iraqis withdrew from Dehloran soon after, claiming that they had "no desire to conquer Iranian territory."

Under the threat of a new and even more powerful invasion, Commander-in-Chief Rafsanjani ordered the Iranians to retreat from Haj Omran, Kurdistan on 14 July. The Iranians did not publicly describe this as a retreat, instead calling it a "temporary withdrawal".

At this point, elements of the Iranian leadership, led by Rafsanjani (who had initially pushed for the extension of the war), persuaded Khomeini to accept the ceasefire. On 20 July 1988, Iran accepted Resolution 598, showing its willingness to accept a ceasefire.

On 26 July 1988, the MEK started their campaign in central Iran, Operation Forough Javidan (Eternal Light), with the support of the Iraqi army. The Iranians had withdrawn their remaining soldiers to Khuzestan in fear of a new Iraqi invasion attempt, allowing the Mujahedeen to advance rapidly towards Kermanshah, seizing Qasr-e Shirin, Sarpol-e Zahab, Kerend-e Gharb, and Islamabad-e-Gharb. The MEK expected the Iranian population to rise up and support their advance; the uprising never materialised but they reached 145 km (90 mi) deep into Iran.

Operation Mersad was the last big military operation of the war. Both Iran and Iraq had accepted Resolution 598, but despite the ceasefire, after seeing Iraqi victories in the previous months, Mujahadeen-e-Khalq (MEK) decided to launch an attack of its own and wished to advance all the way to Teheran.

The Iranians defeated the MEK in the city of Kerend-e Gharb on 29 July 1988.

On 31 July, Iran drove the MEK out of Qasr-e-Shirin and Sarpol Zahab, though MEK claimed to have "voluntarily withdrawn" from the towns.

The last notable combat actions of the war took place on 3 August 1988, in the Persian Gulf when the Iranian navy fired on a freighter and Iraq launched chemical attacks on Iranian civilians, killing an unknown number of them and wounding 2,300.

Iraq came under international pressure to curtail further offensives. Resolution 598 became effective on 8 August 1988, ending all combat operations between the two countries.

By 20 August 1988, peace with Iran was restored. UN peacekeepers belonging to the UNIIMOG mission took the field, remaining on the Iran–Iraq border until 1991.

Iraq spent the rest of August and early September clearing the Kurdish resistance. Using 60,000 troops along with helicopter gunships, chemical weapons (poison gas), and mass executions, Iraq hit 15 villages, killing rebels and civilians, and forced tens of thousands of Kurds to relocate to settlements. Many Kurdish civilians fled to Iran. By 3 September 1988, the anti-Kurd campaign ended, and all resistance had been crushed.

The Iranians used a combination of semi-guerrilla and infiltration tactics in the Kurdish mountains with the Peshmerga. During Operation Karbala-9 in early April, Iran captured territory near Suleimaniya, provoking a severe poison gas counter-attack, and during Operation Karbala-10, Iran attacked near the same area, capturing more territory.

On 8 March 1980, Iran announced it was withdrawing its ambassador from Iraq, downgraded its diplomatic ties to the charge d'affaires level, and demanded that Iraq do the same. The following day, Iraq declared Iran's ambassador persona non-grata, and demanded his withdrawal from Iraq by 15 March.