In a speech to tens of thousand of demonstrators who had gathered to mark the 27th anniversary of the Islamic revolution , President Mahmoud Ahmadinejad also staked out a broader path of resistance if penalties are imposed against Iran .