The United States attacked and seized an Iranian-flagged cargo ship it said had tried to evade its naval blockade near the Strait of Hormuz on Sunday, and Iran's joint military command vowed to respond, throwing a fragile ceasefire into question days before it expires.