A confusing sequence of events has left US President Trump deeply angered and a ceasefire between Israel and Iran on shaky ground.