The Grand Ayatollah Khamenei answered a question about enjoining good and prohibiting bad.
Question: Is it Wajib to enjoin good and prohibit bad before and during wrong act or committing sin, or is it also necessary after the wrong act is committed?
The Grand Ayatollah Khamenei: After committing sin, if it is certain that the sinner intends to continue to commit the sin, (then) enjoining good and prohibiting bad is Wajib; otherwise it is not Wajib.
Source: khamenei.ir (Persian)