The US president has threatened Iran with military strikes amid widespread antigovernment protests there.