In the first major battle of their 12-day-old war, determined Iranian Revolutionary Guards, reinforced by fresh elite commando units trucked in from the east, fought a fierce, last ditch battle against the Iraqi invaders today in the rubble-strewn streets of the strategic Iranian city of Khorramshahr.

After 24 hours of savage fighting inside the besieged and burning port city on the banks of the Shatt-al-Arab, both Iran and Iraq claimed victory tonight, despite evidence that neither was in any position to make such a boast.

The Iranian news agency Pars in Tehran reported today that after "fierce," all-night fighting in the heart of the port, Iraq troops had been forced to retreat from the city.

Baghdad Radio, meanwhile, reported Iraqi forces were inside the port city and that "only a few Revolutionary Guards had remained" behind to oppose them. It also claimed that their forces had cut a key oil pipeline running from Abadan to the Iranian capital.

Elsewhere in the ground war, there were few reports of fighting, but both Iranian and Iraqi warplanes were on the attack again today, and Iran claimed it shot down seven more Iraqi Migs, while Iraq said it knocked out four Iranian jets and three helicopters.

High Iraqi military officials commanding the assault on Khorramshahr said the Iranian forces dug in among the burning rubble of the port were still putting up "very heavy resistance." These officials, from a command bunker a few miles beyond this river hamlet on the left bank of the river, expressed surprise and grudging admiration at the determined opposition being put up by the out-gunned Iranian defenders.

The Iraqi military officials, appearing tired and, with their confidence of of quick victory of only a week ago clearly shaken, spoke of the effectiveness of the Iranian fire power and the seemingly suicidal determination of the Iranian Revolutionary Guards to fight on to the death rather than surrender.

The shabby river port has been pummeled with Iraqi artillery from both sides of the river for more than 10 days. Its wooden warehouses along the port are aflame, as are many of the city's other major buildings. Large parts of the town have been reduced to rubble by shelling. The population itself has long ago fled east past the oil refinery complex of Abadan nearby, seeking shelter from the Iraqi attacks.

"Those Revolutionary Guards simply do not know when to stop," complained one senior Iraqi Army officer today. "They are crazy. They are determined to become martyrs."

Iranian artillery firing from dug-in positions behind the burning oil city of Abadan was laying down a withering fire against the huge Iraqi force of mechanized infantry and tanks that was slowly edging its way into the city. Iranian Phantom jets were also swooping in trying to knock out the advancing Iraqi force.

The Iraqi forces, however, were vastly superior to those of the besieged Iranians. Despite a heavy toll of casualties and equipment which shook Iraqi officers, at least in Khorramshahr victory seemed to be on their side.

More important that the seemingly imminent fall of Khorramshahr in this bitter war between the two neighboring OPEC nations was that the Iraqis also had apparently managed to capture sections of the main oil pipeline running north from Abadan to the Iranian capital of Tehran.

By cutting oil supplies to the refinery in Tehran, the Iraqis hoped to slowly apply more pressure on the government of Ayatollah Ruhollah Khomeini to force it to sue for the peace it has repeatedly refused to even consider so long as Iraqi troops are on Iranian soil.

Iraqi strategy was underlined today by a government statement which said that Iraqi forces had now taken all of their objectives and would henceforth only seek to consolidate their positions.

Since they have yet to actually take any major population center, in spite of their prospects in Khorramshahr, that statement seemed to confirm that the Iraqi forces might be happy to settle down to defending their gains in unoccupied Iranian wasteland and to lift their threatening sieges around the major cities of the oil-rich Khuzestan Province in hope that their control of Tehran's oil supplies would ultimately bring Khomeini to his knees.

It was a gamble at best for Iraqi President Saddam Hussein, who launched the war against Iran with great confidence that victory would be quick and painless, given the common wisdom at the time that two years of Islamic revolution and purges in Iran had left the Iranian armed forces depleted and ineffective.

The fact that after 12 days of war, Iraqi was still fighting a sapping battle for the port of Khorramshahr, which it claimed to have captured on the third day of fighting, was beginning to make some Iraqis question the judgement of their supreme leader to go to war.

A doctor at a military hospital in Basra across the river from this hamlet on the Shatt-al-Arab openly stated that things "were not going so well" at the front, despite the incessant propaganda from Baghdad extolling Hussein's wisdom and leadership and the victorious valor of the Iraqi forces in Iran's southern Khuzestan Province.

A sign that Saddam Hussein himself was eager to underline the popularity of his decision to go to war with Iran came on Baghdad television, where endless messages of support for Hussein were read from various groups around the Arab world and elsewhere. The messages were all similar, extolling Hussein's judgment. There were even messages from as far away as the Baath Socialist Party offices in Tanzania and Colorado in the United States.

Elsewhere in the war, there seemed to be relatively little fighting to the north, where the Iraqis were earlier attempting to seize two other key Khuzestan cities, Dezful and the provincial capital of Ahwaz.

News agency reports were quoting sources in Ahwaz, 60 miles northeast of Khorramshahr, who had come from Dezful as saying there was no evidence of fighting in the northern sector today. Life in Ahwaz was reported even to be relatively normal.

Dezful is a main Iranian military base and oil-pumping station that the Iraqis at first appeared intent upon capturing.

It was not immediately clear whether the slowdown was the consequence of a shift in Iraqi strategy as suggested by the Baghdad military communique saying that Iraqi forces were going to concentrate defending their gains. Another possibility was that Iraqi forces were simply regrouping and preparing for a new offensive.

In Tehran, the government was reporting major gains made by Iranian forces in repulsing the Iraqi invaders, including the recapture of Mehran and Susangerd in the central sector of the 300-mile-long front.

Iranian religious leaders were criticizing numerous Arab states for allegedly helping Iraq, including unnamed "feudal countries" in the gulf.

The Shiite leader at Friday's prayers, Ayatollah Hossein Ali Montazeri, charged that Bahrain, Kuwait, the United Arab Emirates, Jordan, Egypt and Saudi Arabia were assisting Baghdad. Earlier in the war, Tehran warned gulf Arab states not to do this, hinting strongly that Iran would take action against them if they did.