Iran's election looks like it was rigged. Which begs the obvious question as to why.
Obviously Iran is a corrupt undemocratic theocracy but the usual means of rigging elections is to prevent all but a select group of pre approved candidates from standing in the first place and then let the election proceed normally.
It might make sense as a gesture of hostility against the outside world but the amount of internal dissent it has created seems like a high cost to pay for a gesture.
Update: My theory, which I haven't put to any thorough examination, is that the Ayatollah's decided to fix the election only after the results of the Lebanon election where Hezbollah's alliance did worse than anticipated. After all if that was followed by a 'reformer' winning in Iran it would create momentum for reformers.