In a major show of strength by Iran's religious opposition, hundreds of thousands of Iranian Moslems demonstrated noisily but mostly peacefully across the country yesterday to express dislike for the government and to demand that Iran's top religious leader be allowed to return from exile.

The demonstrations coincided with religious ceremonies in which millions of Iranians celebrated the end of the Moslem holy month of Ramadan, a period that has seen the most serious wave of violent antigovernment protest to hit Iran in more than eight months of widespread disturbances.

Minor clashes between demonstrators and police in at least four towns marred the otherwise peaceful day of protest. The state-run radio said two policemen and two protestors were killed in Ilam, the capital of a western province bordering Iraq. Disturbances were also reported in few other provincial towns including the holy city of Qom, seat of Iran's moderate Shite Moslem opposition movement.

In Tehran, a procession of up to 15,000 demonstrators, including large numbers of women wearing black head-to-toe veils, marched down a main avenue from the northern part of the city shouting religious and antigovernment slogans.

Residents said it was the largest opposition demonstration in the capital in 25 years.

The atmosphere was tense as the marchers came upon two trucks and a jeep full of Iranian soldiers carrying automatic rifles with fixed bayonets and a machine gun on a tripod.

Suddenly, the demonstrators began pelting the soldiers with flowers. The marchers stopped alongside the troops for about half an hour, alternately kneeling and praying in the street, shouting slogans and pummeling the sides of the army trucks.

"Moslems arise, your brothers have been killed," the demonstrators shouted, thumping their chests in Islamic mourning tradition. They referred to the scores of demonstrators killed by police and army gunfire in the recent disturbances.

Addressing the troops they chanted, "Why do you kill your brothers?"

The soldiers sat impassively, hardly moving but occasionally grinning sheppishly as the shower of flowers littered the floors of their trucks. After the initial tension, a carnivul atmosphere began to take over and each wave of demonstrators applauded the soldiers for their restraint before moving on. Other units of police and army troops remained out of sight on nearby streets.

In all, more than 100,000 people are estimated to have taken part in demonstrations in different parts of Tehran yesterday.

The protests followed a weekend of the worst rioting to hit the capital so far this year after thousands of worshipers were locked out of a mosque in central Tehran. Several people were reported killed and scores arrested when police and troops intervened to disperse the gathering.

On the orders of a clergyman, the demonstrators refrained from chanting more virulent slogans against Shah Mohammed Reza Pahlavi. In open defiance of him, however, they called for the return of Ayatollah Ruhollah Khomeini - exiled to Iraq by the shah 15 years ago after violent antigovernment demonstrations. They carried posters and banners bearing his picture.

"Iran is our country, Khomeini is our leader," they cried.

The protest march stemmed from a gathering of an estimated 30,000 people on a dusty lot in northern Tehran.Surrounded by banners with religious slogans - including one in English which said, "Our struggle is for the establishment of an Islamic social order" - the audience heard a prayer leader strongly denounce the shah and the new government he installed eight days ago. The speaker said Khomeini "is our only leader" and called for a strike Thursday to back demands for his return.

Khomeini, who lives in the Shite shrine city of Najaf in Iraq, is considered the most radical of Iran's ayatollahs (a top Moslem religious rank) and the one with the largest following. In his latest statements distributed here, the gaunt, bearded leader has called for the overthrow of the shah, an action increasingly endorsed in Iran but one that the country's moderate religious and political opposition is not yet willing to countenance.

"The people will not rest until the decadent Pahlavi rule has been swept away and all traces of tyranny have disappeared," Khomeini said in a recent statement issued on the eve of Ramadan.

He also condemned the shah's call for free legislative elections next year, saying "as long as the shah's satanic power prevails not a single true representative of the people can possibly be elected."

Nevertheless, the government is going ahead with a program that seems to be dramatically loosening the restraints on political life. Under the new prime minister, Jaffar Sharif-Emami, censorship of the privately owned press has been removed, and new political parties have been emerging. So far about 30 have declared their existence.

That yesterday's demonstrations were permitted is another result of this political relaxation, observers believe. Now many Iranians are hoping the recent cycles of violence will give way to a peaceful political process under a more tolerant government.