The protests marked the 40th day since the shooting of Neda Agha-Soltan was caught on video and posted on the Internet. For Shiite Muslims, the 40th day is of religious importance, often an occasion for an outpouring of emotion and grief. Thirty years ago, such commemorations helped build momentum for the Islamic revolution that overthrew the shah. The protesters' resilience this time set the stage for more clashes next week, when hard-line President Mahmoud Ahmadinejad is inaugurated for a second term -- despite allegations that he won because of widespread fraud in the June 12 vote. Still, the scale and reach of Thursday's protests, which also erupted in at least four other cities, appeared to catch security forces off guard. After initially bloodying some of the mourners arriving at Behesht Zahra cemetery, security officers stepped back. They mingled amicably with protesters, many of them young women dressed in black and carrying roses, and in one case even accepted flowers from them. The mourners chanted political slogans as they rode the Tehran subway from the city center to the cemetery and back. When they returned to the center, they took to the streets -- first in the area of the Grand Mossala mosque, where they had been banned from gathering. Later along side streets and main thoroughfares, they were occasionally attacked by baton-wielding security personnel, some on motorcycles. But they also were cheered on by thousands of well-wishers honking car horns or hanging out the windows of apartments and buses. They clogged traffic on roadways and tunnels, holding up signs supporting opposition leader Mir Hossein Mousavi. Shopkeepers distributed bottles of water to sustain the demonstrators in the heat. 'Honorable Iranians,' the protesters chanted. 'Today is a day of mourning.' And in a challenge to a harsh media crackdown, they videotaped everything and quickly flooded the Internet with amateur footage of the day's events in the capital as well as the provincial cities of Isfahan, Shiraz, Ahvaz and Rasht. 'Death to the dictator,' chanted those in one long procession heading toward Agha-Soltan's grave, kicking up a storm of dust as they walked. 'Neda is not dead. This government is dead.' As night fell, witnesses reported severe confrontations between demonstrators and security forces in north-central Tehran. Trash bonfires lit to counter the effects of tear gas belched black smoke into the sky. Residents rushed injured protesters into their homes to protect them from roaming bands of Basiji militiamen. Iranian officials say 30 people died in unrest since the election. But human-rights monitors and independent observers say the number killed in the protests and subsequent crackdown is at least twice that figure in the capital alone. On Wednesday, the Paris-based monitoring group Reporters Without Borders urged authorities to explain the death of journalist Alireza Eftekhari on June 15. His body was handed over to relatives on July 13. A news release said Eftekhari died of a severe beating. Authorities have tried without success to quell the unrest using the coercive instruments of the state, angering even some of Ahmadinejad's conservative allies. (Begin optional trim) On Wednesday, the Tehran prosecutor's office announced the arrest of the latest in a series of prominent political figures: Saeed Shariati, a member of the reformist Islamic Iran Participation Front's central committee. Authorities also have announced that they will place the first group of protesters on trial. According to a statement by the prosecutor's office, they will be charged with offenses including having ties to terrorist organizations, invading and torching military bases, destroying public property, looting, and preparing and dispatching news reports for 'enemies' of the Islamic Republic. Still, under massive public and international pressure, authorities also have acknowledged official wrongdoing. Supreme Leader Ayatollah Ali Khamenei this week ordered the Kahrizak detention center south of Tehran closed because its facilities are 'substandard.'Iran's police chief, Ismail Ahmadi Moghaddam, said some law enforcement officers 'went to extremes' during protests. Late Wednesday, two prominent jailed reformist politicians, Behzad Nabavi and Mostawfa Tajzadeh, were allowed to phone their families from prison for the first time since they were arrested June 13. And authorities moved Said Hajjarian, who was critically wounded in a 2000 assassination attempt, from prison to a detention house with medical facilities, the Mehr news agency reported. (End optional trim) But such steps may not be enough to appease an emboldened opposition, which is supported by a grass-roots political movement unlike any the Islamic Republic has experienced. Former President Mohammad Khatami, speaking to a group of reformist lawmakers, called for an investigation into allegations of torture and murder. Among the demonstrators, spirits seemed to be rising. (Begin optional trim) 'We can not foresee any reconciliation between the two camps,' said Reza, a 25-year-old at the cemetery. 'So we go for collapse of the entire system in long term.' Hamid, a 24-year-old engineering school graduate from what he described as a wealthy family, said he'd given up his previously luxurious lifestyle to devote himself fully to undermining the government. 'A general strike won't work now,' he said. 'These demonstrations are better than strikes because with a smaller number of people we ... make them fear for tomorrow.' (End optional trim) Parisa, a 22-year-old college student, says she's already been in so much trouble with the authorities and her college that there is no turning back. 'Whether I come to the demonstrations or not, the authorities will be keeping an eye on me forever,' she said. Mousavi and his wife, Zahra Rahnavard, tried to attend the mourning ceremony but were prevented by security forces, who in some cases appeared divided over whether to beat the demonstrators or guide them to Agha-Soltan's grave. An amateur video showed mourners surrounding police officers lounging on an official vehicle, chatting amicably. One witness estimated that 10,000 people flooded into the cemetery. Another, 30-year-old Koroush, said from a bridge he could see thousands more were outside the cemetery unable to get in. One person absent was Agha-Soltan's mother, Hajer Rostam Motlagh. Many of the parents of those who have died have been explicitly warned not to publicly mourn their dead, but she had vowed earlier this week to attend the gathering. Motlagh instead went to a park near her home. A photograph showed her sitting cross-legged on grass before a single candle. In an interview with BBC Persian earlier this week she said she didn't want people to forget her daughter, a former student of Islamic philosophy who had cultivated a passion for music and travel. And she said she had a message for the world. 'I want you, on my behalf, to thank everyone around the world, Iranians and non-Iranians, people from every country and culture, people who in their own way, their own tradition, have mourned my child,' she told the interviewer. 'Everyone who lit a candle for her, every musician who wrote songs for her, who wrote poems about her, I want to thank all of them.' Times staff writer Dargahi reported from Beirut, Lebanon, and special correspondent Mostaghim from Tehran. 