There is also great danger for Khamenei here in that any attempt to seriously crack-down will create a large number of martyrs. In Islam and particularly in Iran this presents a great challenge to the ruling power and undermines the legitimacy of the "Islamic Republic."
I think the legitimacy of the Republic has already been largely undermined. If the Ayatollah goes further he will lose the support of the masses entirely. There are two foundations of the Islamic Republic of Iran that are critical for its legitimacy with the people: Respect for Islamic principles and respect for the will of the people. A violent suppression of protest at this juncture would constitute a violation of Islamic principle and the second has already occurred.