The riots were the worst in Iran since the revolution of 1979. Thousands of students took to the streets, pelting stones at security forces and setting fire to pictures of the country's Supreme Leader, Ayatollah Ali Khamenei.
The disturbances left a trail of burned-out vehicles and smashed shop fronts.
The unrest started with peaceful demonstrations following new parliamentary legislation to curb press freedom and the banning of a leading pro-reformist newspaper, Salam, on 7 July.
But on the night of 8 July, riot police attacked a hostel where students had gathered. One student was killed; the demonstrations escalated into violence.
There was national outcry at the hostel attack. The Minister of Higher Education, Mostafa Moin, and the Chancellor of Tehran University both resigned, saying the security action was unacceptable.
Street battles
Over the next few days at least two more people were killed and hundreds injured as rioting escalated.
It was a direct challenge to the conservative clerical establishment that President Mohammad Khatami was struggling against. He had come into power two years previously with plans for democratic reform, openness and improved human rights.
Iranian students had played a major role in overthrowing the monarchy in 1979 and now became a powerful force in favour of Mr Khatami's programme. But many wanted a faster pace than he was able to deliver.
When the riots spilled into the streets, the pro-Khatami student leaders distanced themselves and public opinion turned away from the students.
The president turned against the protesting students, and denounced the riots.
"They were against the interest of the nation, and against the policies of the government. This event is just the opposite of the political development advocated by the government," he said.
Despite appeals for calm, violence spread to other cities. On 11 July a theology student was shot dead in Tabriz, in north-west Iran.
On 12 July a ban was announced on rallies, and the following day, after a sixth day of unrest in Tehran President Khatami threatened tough action to restore order.
Several thousand students had taken to the streets of Tehran, where there were running street battles in several areas. Plain-clothed security forces used tear gas and fired shots into the air to disperse the crowds.
Following the violence many rioters were jailed and three alleged ring leaders were sentenced to death.