Mr. de Blasio has spent at least a month traveling around the country since he announced that he was exploring a run for president earlier this year. He formally announced his candidacy in May. He stepped up his travels in early July, campaigning in Chicago, Houston, New Orleans, Iowa and South Carolina.

So far, Mr. de Blasio has avoided having to deal with a major crisis while he was out of town, but there have been close calls. In February, when he was still exploring a run for president, Mr. de Blasio canceled a trip to New Hampshire after a veteran New York Police Department detective was killed while responding to a robbery.

That decision was apparently more clear-cut than the one he faced on Saturday. At first, the mayor was told by officials that the blackout was limited to about 20,000 customers and a relatively small area. An hour later, that number had doubled.

By 9:30 p.m., Mr. de Blasio was getting reports that 72,000 customers were affected.

“Once he learned that this was going to be a bigger problem than originally thought, he made the decision to come back to New York,” said Freddi Goldstein, Mr. de Blasio’s press secretary.

But there were no immediate flights available in Iowa, so Mr. de Blasio was driven 300 miles to Chicago. Even so, Mr. de Blasio was not able to board a flight back to the city until Sunday morning.

Chris Coffey, who leads the New York practice for Tusk Strategies, a political and strategic consulting firm, said the mayor may have alienated New York voters who “tuned in and saw a really active” Mr. Johnson and Mr. Cuomo, while Mr. de Blasio was shown being interviewed from Iowa.

“I don’t know if that matters if you’re a voter in Iowa and New Hampshire, unless there is a perception that comes from the blackout and ICE raids that he’s not governing his city,” Mr. Coffey said.