US president says he would back attacks if Tehran rebuilds nuclear or missile programmes.