TEHRAN - Crowds of demonstrators battled security forces armed with tear gas and batons during a surprisingly large anti-government protest in the Iranian capital Monday that drew inspiration from the recent popular uprisings in Egypt and Tunisia.

Dodging clouds of tear gas fired by police and pro-government militiamen, the protesters marched down a central boulevard and shouted slogans such as "Death to the dictator," "We are all together" and "Down with Taliban, in Cairo and Tehran."

Witnesses at several positions along the route said vast throngs of people could be seen marching from Enghelab (Revolution) Square toward Azadi (Freedom) Square, overwhelming police efforts to stop them.

Dozens of protesters were arrested for participating in the banned rally, an opposition Web site reported. A similar demonstration, clashes and arrests were reported in the central Iranian city of Isfahan.

The gathering in Tehran appeared to be the most significant anti-government protest here since security forces cracked down on a series of massive demonstrations in 2009. The size of the crowd was difficult to estimate. Some witnesses said they believed it exceeded 200,000. The Associated Press said tens of thousands of people demonstrated.

In any case, the government seemed to have been taken by surprise by the large numbers of protesters. Security forces shot dozens of tear gas grenades at demonstrators who at times attacked members of the pro-government paramilitary Basij forces.

Police, who seemed to be mobilized in smaller numbers than usual, tried to disperse the protesters using batons and tear gas. A man was seen coming to the rescue of his wife after a helmeted officer hit her on the legs.

In the afternoon, as the crowds grew, the police were seen retreating in some areas. By evening, the protesters seemed ready to disperse. Internet service had been disrupted in Tehran, so it was difficult to ascertain the next steps for organizers, who had relied on Web sites and social media to launch Monday's rally.

The roads near Tohid Square in western Tehran were lined with rocks, and steel street barriers were erected blockades against groups of Basij members.

After sunset, trash cans were set on fire as members of Iran's elite Revolutionary Guard Corps drove past on their signature motorcycles and shot some bystanders with tear gas and paint guns. Some people in the crowd handed out masks that offered some protection from the stinging fumes. Others lit small fires that also provided relief.

Some demonstrators held green ribbons, the color of the opposition movement that sprang to life after President Mahmoud Ahmadinejad's disputed election victory in 2009.

After the election, the movement staged widespread protests. Those protests were eventually stifled by security forces, including the Revolutionary Guards and the Basij militia, which are fiercely loyal to Iranian Supreme Leader Ayatollah Ali Khamenei. Two people were hanged and scores of opposition supporters jailed. The last mass demonstration was in December 2009.

The 2009 protests were led in part by presidential challenger Mir Hossein Mousavi, whose defeat by Ahmadinejad at the polls was widely questioned.

Mousavi also called for Monday's demonstration, saying people should rally in support of the protesters in Egypt and Tunisia who had succeeded in toppling their governments.

Although Iran's government has praised the Egyptian and Tunisian uprisings, officials refused to grant a permit for a gathering in Iran.

A statement on a Mousavi-affiliated Web site in advance of the rally warned that any violence directed at the protesters by security forces would be an international "disgrace" and would undermine the government's public support for the Egyptian and Tunisian protesters.

"Do not allow the infiltrating agents of those seeking violence to derail the demonstrations with their aggressive behavior under any circumstances," the statement posted on Kalamah.com said. "The noble people of Iran should participate in the peaceful demonstration, with calm and resolve."

On Saturday, the White House called on the Iranian government to allow its people to assemble.

"The Iranian government has declared illegal for Iranians what it claimed was noble for Egyptians," national security adviser Thomas E. Donilon said in a statement.