Hundreds of thousands of Iranians massed Thursday in central Tehran to mark the anniversary of the revolution that created the country's Islamic republic, while a heavy security force fanned out across the city and moved quickly to snuff out opposition counterprotests.

Police clashed with protesters in several sites around Tehran, firing tear gas to disperse them and paintballs to mark them for arrest. Gangs of hard-liners also attacked senior opposition figures as they tried to attend the rallies — including the wife of the head of the reform movement.

Plainclothes Basiji militiamen beat 65-year-old Zahra Rahnavard with clubs on her head and back until her supporters formed a human ring around her and whisked her away, according to the Web site of her husband, Mir Hossein Mousavi.

The celebrations marking the revolution's 31st anniversary were an opportunity for Iran's clerical regime to tout its power in the face of the opposition movement, which has managed to keep up periodic street protests since the disputed June presidential elections despite a fierce crackdown.

SLIDESHOW: Clashes Mark Iranian Revolution Day

The opposition turnout was dwarfed by the huge crowd at the state-run celebrations. Many were bused in to central Azadi, or Freedom, Square to hear an address by President Mahmoud Ahmadinejad, who proclaimed a new success in Iran's uranium enrichment program and dismissed new U.S. sanctions.

And the massive security clampdown appeared to succeed in preventing protesters from converging into a cohesive demonstrations. Large numbers of riot police, members of the Revolutionary Guard and Basij militiamen, some on motorcycles, deployed in back streets near key squares and major avenues in the capital to move against protesters.

Opposition Web sites spoke of groups of protesters in the hundreds, compared to much larger crowds in past demonstrations

One protester told The Associated Press she had tried to join the demonstrations but soon left in disappointment. "There were 300 of us, maximum 500. Against 10,000 people," she told an AP reporter outside Iran. She said there were few clashes.

"It means they won and we lost. They defeated us. They were able to gather so many people," she said. "But this doesn't mean we have been defeated for good. It's a defeat for now, today. We need time to regroup."

Another protester insisted the opposition had come out in significant numbers, but "the problem was that we were not able to gather in one place because they (security forces) were very violent."

Both spoke on condition of anonymity for fear of retaliation by authorities, who have jailed protesters for talking to foreign media.

Authorities banned foreign media in Iran from covering the pro-reform protests, while allowing them to cover the official anniversary ceremonies, including Ahmadinejad's speech, but there is a ban on covering opposition protests. Tehran residents also reported Internet speeds dropping dramatically and e-mail services such as Gmail being blocked in a common government tactic to foil opposition attempts to organize.

Thousands upon thousands marched along the city's broad avenues toward Azadi Square to celebrate the anniversary of the 1979 Islamic Revolution, according to footage on state TV. There, the massive crowds waved Iranian flags and carried pictures of Ayatollah Ruhollah Khomeini, the founder of the Islamic state, and his successor as supreme leader, Ayatollah Ali Khamenei.

State buses ferried many to the square. State media touted the turnout as a show of support for the government — though to an extent, celebrations for the revolution cross partisan lines, and many Iranians who oppose Ahmadinejad but support the clerical leadership turn out annually. Among those attending was influential former president Akbar Hashemi Rafsanjani, an opposition supporter.

In his nationally televised address in the square, Ahmadinejad proclaimed that Iran has produced its first batch of uranium enriched to a higher level, 20 percent — and boasted that Iranian scientists are capable of going even further, to 80 percent. "But we don't ... because we don't need it," he said.

A day after Washington announced new sanctions on Iran over its nuclear program, Ahmadinejad vowed "the Iranian nation will never give in to bullying and illogical remarks.

He repeated Iran's stance that it is not building a nuclear weapon and does not intend to do so, adding, "If we wanted to manufacture a bomb, we would announce it."

Iran's move to further enrich uranium — from around 3 percent purity to 20 percent — has drawn sharp criticism from the United States and its allies, which accuse Tehran of seeking to develop a nuclear bomb. Uranium enriched to 90 percent can be used to build a warhead.

Ahmadinejad made no mention in his speech of Iran's political turmoil.

For days ahead of the anniversary celebrations, anti-government Web sites and blogs have called for a major turnout in counterprotests. Groups of opposition protesters gathered Thursday in several locations around Tehran, wearing green clothes and waving green balloons — the opposition's signature color.

Security forces fired tear gas to disperse a group of protesters who were trying to march toward Azadi Square as they chanted "death to the dictator," the opposition Web site Kaleme said, reporting an unknown number of arrests. Police and Basijis on motorbikes swept toward central Tehran, where protesters and security forces clashed in several locations, it reported.

The heaviest violence appeared to be in Sadeqieh Square, about a half-mile (one kilometer) from the anniversary rally, where riot police fired paint-filled balls at hundreds of protesters chanting opposition slogans, witnesses said. The witnesses spoke on condition of anonymity for fear of retribution from authorities.

The assault on Mousavi's wife took place in the square, and government supporters also blocked Mousavi himself from joining the protests, his Web site said.

Hard-liners also attacked the convoy of another senior opposition leader, Mahdi Karroubi, as he headed to the square, his son Hossein Karroubi told The Associated Press. The attackers smashed the windows of his car, forcing him to turn back from joining the protests, he said.

Security forces also briefly detained Khomeini's granddaughter and her husband, who are both senior pro-reform politicians, according to the couple's son, Ali.

The granddaughter, Zahra Eshraghi, and her husband Mohammad Reza Khatami, who is the brother of a former pro-reform president, were held for less than an hour before being released, their son told the AP.

The opposition claims that Ahmadinejad's victory in the June 12 election was fraudulent and that the true winner was pro-reform leader Mir Hossein Mousavi. Hundreds of thousands marched in the streets against the government in the weeks after the vote, prompting a massive wave of arrests.

Nevertheless, the opposition has succeeded in continuing to hold regular protests, often timing them to coincide with days of important political or religious significance in attempts to embarrass authorities. The tone of the rallies has shifted from outrage over Ahmadinejad's re-election to wider calls against the entire Islamic system, including Khamenei.

Tensions have mounted further since the last large-scale marches, in late December, which brought the most violent battles with security riots in months. At least eight people were killed in clashes between protesters and police, and security forces have intensified arrests in the weeks since.

In January, two people who were put on trial alongside opposition politicians and protesters were executed for allegedly plotting to overthrow the state. Authorities have announced that 10 other opposition supporters have also been sentenced to death — a move many believe was aimed at intimidating protesters.