Iraq acknowledged today that it had lost control of the Iranian port city of Khuninshahr on the Shatt-al-Arab waterway and said its troops had pulled back to the Iraqi border eight miles to the west after inflicting heavy losses on Iranian forces.

The statement came as Iran stepped up its pressure on the Arab states of the Persian Gulf to end their support for Iraq and as four radical Arab nations came out for the first time openly on the Iranian side, deepening the already bitter division in the Arab world over the 20-month-long conflict.

As the Iranian victory over Iraq was unfolding at Khuninshahr, formerly known as Khorramshahr, the conservative Arab monarchies of the gulf that have been supporting Iraq were watching closely for indications of future Iranian intentions, not only toward Iraqi President Saddam Hussein but also toward their own vulnerable governments.

Today Iran repeated its warnings to the other Arab gulf states, which have provided billions of dollars in logistical support to Iraq during the war, to end their assistance.

Offering them "a piece of brotherly advice," religious leader Ayatollah Ruhollah Khomeini told them, "Do not do anything that will oblige us, under the tenets of the Koran, to treat you according to divine law."

Iranian leaders recently have singled out Kuwait for special warning, raising fears here of another Iranian bombing raid on Kuwaiti territory and installations such as Kuwait said occurred Oct. 1, 1981, at the Umm al Aish oil and gas separation plant.

A week ago, Iranian Prime Minister Hossein Musavi said Kuwait was still giving aid to Iraq, adding, "It will suffer some damage because of its hostility toward Iran and the great Islamic revolution."

Kuwaiti officials today were taking a wait-and-see attitude toward the latest developments, aware, as one put it, that "there will be certain repercussions" in the region because of Iran's victory over Iraq.

The Iranian-Iraqi war has forced a deep division within the Arab world between the conservative governments that have supported Iraq and the more radical ones that have tilted increasingly toward Iran.

Yesterday the divide grew worse as members of the so-called Steadfastness Front--Algeria, Libya, Syria, South Yemen and the Palestine Liberation Organization--came out openly in favor of Iran.

The front declared in Algeria that Iran was a "friendly revolution" deserving of its support in its war with Iraq. It also opposed any effort by the conservative Arab states to reconcile Egypt with the Arab world as long as Cairo continues to adhere to the Camp David accords.

An Iraqi military spokesman announced early today that the evacuation of Khuninshahr, occupied by Iraq at the start of the war, had begun on Sunday and was completed this morning.

The spokesman justified the retreat, saying that Iraq had achieved its objective of inflicting the highest possible casualties on Iran "to stop it from continuing with its blatant aggressive and expansionist plans."

Yesterday, Iran announced that it had retaken the port city, which controls Iraq's access to the Persian Gulf through the Shatt-al-Arab, captured 12,000 Iraqis and killed the top Iraqi commander in a two-day battle. At first, Iran said 30,000 Iraqi soldiers had surrendered.

The Iranian recapture of Khuninshahr appeared to herald the winding down of the costly gulf war, with the retreating Iraqis now holding only several stretches of Iranian land farther to the north. But Iran's stated struggle to topple Saddam Hussein seems far from over.

The war began in September 1980, when Saddam Hussein sent Iraqi troops into Iran in a bid to establish control over the Shatt-al-Arab, taking advantage of the confusion and disarray in the Iranian armed forces caused by the Islamic revolution. The Iranians hold Saddam Hussein personally responsible for starting the war, although he has argued that it was aimed at ending Iranian subversion of his own rule.

There was no indication today whether Iraq also was withdrawing from the other Iranian areas it still holds. Another Iraqi communique later reported that attacking Iranian forces had been repulsed with heavy losses by Iraqi troops at an unspecified location north of Khuninshahr.

The Iranians have listed as their main demands for an end to the war the withdrawal of all Iraqi forces, war reparations and the establishment of an international committee to identify the aggressor.

Iranian leaders also have made clear that they desire the overthrow of Saddam Hussein, who was responsible for Khomeini's expulsion from Iraq in October 1978 at the late shah's request.

The Kuwaiti undersecretary of state for foreign affairs, Rashid Rashid, said in an interview that there were conflicting signals from Iran as to whether to push across the border into Iraqi territory.

"They the Iraqis are at the international border and now that they are there, our hope is that the differences could be settled peacefully without any more intrusions into one another's territory," he said.

Rashid questioned whether Iran would attack Iraq directly or carry its war to other Arab gulf states, knowing that this would probably provoke reactions from both the Soviet Union and the United States.

Rashid defended the Persian Gulf states' role in the conflict, saying that they had always urged negotiations, a cease-fire in the war and the withdrawal of Iraqi troops.

Kuwait, Saudi Arabia, the United Arab Emirates and Qatar are believed to have provided Iraq with about $24 billion in financial aid.