The attack on ships in the Red Sea threatened to expand the conflict and severely impact global oil supplies already hobbled by the blockade of the Strait of Hormuz.