A senior Iranian official said Iran had fired a warning shot and that it was unclear whether the warship had been damaged.