Iran said Monday that it will accept unconditionally a U.N. resolution calling for an immediate cease-fire in its nearly 8-year-old war with Iraq, which has claimed an estimated 1 million lives.

However, Iran also said it will not withdraw its troops from its borders and called on Iranians to prepare to thwart further Iraqi attacks.The announcement came one day after President Saddam Hussein of Iraq cited his country's recent string of battlefield victories and urged Iran to accept an "honorable" peace. Iraq has already accepted the U.N resolution, which passed on July 20, 1987.

In a message to U.N. Secretary-General Javier Perez de Cuellar, Iran said it accepts cease-fire Resolution 598 in the "interests of security on the basis of justice," the official Islamic Republic News Agency said.

In New York, Perez de Cuellar said Iran's acceptance of the cease-fire resolution was unconditional and showed reporters at the United Nations the letter of acceptance signed by President Ali Khamenei of Iran.

Iraq's information minister, Nassif Ltayyif Jassem, said Iran accepted the U.N. resolution for tactical reasons and not out of any desire for peace.

"Our previous knowledge of the devious Iranian regime makes us be cautious and wary until peace is achieved and until we reach an agreement between Iran and Iraq for peace," he said.

"We haven't been officially apprised of the Iranian letter to the United Nations. We are still dealing with news we learned about by listening to Tehran radio," he said in statements reported by the Iraqi News Agency.

In a report monitored in Nicosia, the Iranian news agency said the General Command of the Iranian Armed Forces announced in Tehran that the government was accepting the cease-fire resolution.

"Today new conditions have been created which call for adoption of new stances in order to continue the sacred defense and protect Islam," IRNA said.

"We once again urge the Iranian people to man the war fronts to confront the enemies' aggressive nature and foil their criminal acts," the General Command of the Armed Forces said. "All Muslim combatants deployed on the war fronts are prepared to respond to any aggression and movement of the enemy."

Iran did not say when the cease-fire would go into effect.

In Washington, the State Department said it would have no immediate comment, but the ambassador in Baharain called the announcement "beautiful news."

"It's time for rejoicing," said Ambasador Sam H. Zakhem. "It's beautiful news." Zakhem praised President Reagan for "drumming up support for peace in this part of the world, for which we have waited so long."

Iraq and Iran "are the true beneficiaries. They've had enough of the killing and bloodshed," he said.

U.S. naval officers in the Persian Gulf said they were waiting for official word from Washington.

"Holy cats. You've got to be kidding," exclaimed an officer aboard the Navy's command ship Coronado, moored at Bahrain, when informed of the news by telephone.

The officer, who refused to identify himself, said no official word had been passed to other U.S. ships in the Persian Gulf.

Officers declined to speculate on how quickly or in what way a cease-fire would affect the Navy's operations in the waterway. The United States now has 27 U.S. warships in and around the Persian Gulf to guard commercial shipping.

"We're taking a wait-and-see attitude," said the officer. "Until we hear it from the horse's mouth, we'll just hope for the best

and see what happens."

Rear Adm. Anthony Less, commander of the Persian Gulf-based naval forces, was not aboard the flagship but was advised of the report by telephone.

A naval source who spoke on condition of anonymity said Less was elsewhere with a team of U.S. military experts investigating the July 3 downing of an Iranian jetliner by the U.S. missile cruiser Vincennes.

The Vincennes was also anchored off Bahrain.

Tehran, in announcing its acceptance of the cease-fire, said it had been portrayed as "war-mongering Muslims before world public opinion."

The statement said the cease-fire acceptance was part of a strategy of defending the Islamic Revolution that toppled the government of Shah Reza Pahlavi in 1979. It said the Iranian position should not be interpreted as caving in to pressure from the United States and Iraq.

In the past three months, Iraq has recaptured nearly all the territory it lost to Iran over the past six years. There has been no official casualty toll in the war, but foreign analysts put it at more than 1 million.

One of the conditions for the U.N. cease-fire was that both countries return to their borders at the time the war started in 1980. The resolution also calls for an exchange of prisoners and determination of who was responsible for starting the war.

Iran had demanded that Iraq be labeled the aggressor before it accepted the resolution. Iraq invaded Iran in September 1980 after border skirmishes.

In April, the Iraqis began recapturing territory lost to Iran and claim they have since seized about 133 strategic heights in the northern region of the 730-mile long front.

They also launched assaults in the south that recaptured the southern Faw peninsula in April and the Shalamcheh and Majnoon islands in May and June.

In addition to its battlefield defeats, the Tehran government has found it increasingly difficult to recruit soldiers and keep its economy afloat.

In addition to recent territorial losses, the Iranian population suffered a severe psychological blow in the so-called "war of the cities" between Feb. 29 and April 21.

As many as half of Tehran's 6 million population fled to the countryside to escape the missiles that blasted a path of destruction across the city. The Iranians were clearly outgunned. The Iraqis fired nearly 200 long-range missiles, believed to be upgraded Soviet Scud weapons. The Iranians were only able to fire one-third that number in retaliation.

Iran sought a Security Council emergency hearing on the airliner attack by the Vincennes and during debate last week, but the council has so far refused to condemn the United States for the attack.

During the debate, nation after nation on the 15-member council urged Iran to accept the cease-fire resolution. Those nations included the Soviet Union, Britain, France, China, Japan and West Germany.