At the time, I also heard another reason, which, if true, would be the main reason. There are serious doubts about the military itself. The army and parts of the Revolutionary Guards (abbreviated as RG) would, under those circumstances, choose the side of the opposition and the people. The military power of Khamenei would be broken. This, however, was speculation without proof.
Now there is evidence to support it. On December 10, a statement signed by a number of officers and commanders of the Iranian army was released. The regular army of Iran had not been involved in the suppression of the population. The statement was signed by:
* Pilots and personnel of the aviation division of the regular army (Havanirooz)
* Commanders and personnel of the 31th artillery division of Isfahan of the regular army
* Pilots and airmen of the regular army
* Teachers of the Shaid Satari University of the regular air force
* Officers and staff of the logistics training unit the regular army
* Professors and lecturers of the Imam Ali University for officers of the regular army
* Officers, staff, and commanders of the chief of staff of the regular army
What did these soldiers write?
From what I read, when the PRC decided to smash the protesters at Tiananmen Square they brought in units from way the hell out in other parts of China: they did not want any troops who might be related to, connected to or have sympathy with the protesters. Iran can't do that: too many people in too many places protesting, family and friends and people who, without doubt, have the sympathy- even if not active agreement- of people in the military. You order a general 'arrest and kill and imprison', you're going to have problems. Which Iran can't afford.
They go on: “Therefore, we warn the Guards who have betrayed the martyrs (from the war between Iran and Iraq) and who decided to attack the lives, the property and the honor of the citizens. We seriously warn them that if they do not leave their chosen path, they will be confronted with our tough response. The military is a haven for the nation. And we will defend the peace-loving Iranian nation against any aggression.”
That's about as blunt as it gets: "Do what you're considering and there will be war in this country; we will not stand by while you do this."