The Metropolitan Transportation Authority attributed the disruption to a “network communications” issue and said on Twitter around 6 p.m. that the Nos. 1, 2, 3, 4, 5 and 6 lines and the Times Square shuttle were all affected.

About 90 minutes later, it was reporting that service was slowly being restored.

Corey Johnson, the City Council speaker, said on Twitter: “Servers are back up. Trains beginning to move. Those at back of queue will still take a while to move. River tunnels confirmed clear. MTA is prioritizing express tracks.”

The abrupt interruption in service during the evening rush left passengers and city politicians alike fuming. It also underscored problems affected the aging, troubled mass transit system.

The disruption Friday was the second major infrastructure failure in the city in a week. A blackout last Saturday cut power to the subways and caused passengers to be evacuated.

Tim Minton, the MTA’s communications director, said in a statement that a “total stoppage” happened at 5:50 p.m. because of “a failure in the computer system that powers our signals in the A Division.”

The statement continued: “For safety reasons, trains were required to maintain their positions at the time of the interruption, and some of those trains were in between stations when that occurred. We worked to progressively move trains into stations while, simultaneously, technicians were successfully able to reboot the servers.”

He said service started to be restored at 7:16 p.m., with substantial residual delays. Power for lighting and air-conditioning remained on during the disruption, he said.

“Investigation of the root cause of this system failure is underway,” he said. “Service on lettered lines (B division) was not impacted.” He added that there were no indications that the failure was “heat or power related, but investigations are underway.”

Maxine Wally, 29, a journalist for Women’s Wear Daily, said it took 2.5 hours to go from Grand Central Terminal to her sister’s house in Brooklyn.

She said she waited 40 minutes on a 5-train at Borough Hall that was stuck inside the station before switching to the B41 bus that was packed.

“One guy got onto the bus and he was saying he was going to pass out from the heat,” Wally said. “He was cursing at people to move in. A fight almost broke out on the bus. It was madness — a real New York moment.”

Trevona Brown and a friend paused in a busy area at the 14th Street-Union Square station where the police had blocked off stairs to the 4, 5 and 6 trains with yellow tape. A harried MTA worker in an orange vest and with a white towel around his neck raised his hands, trying to direct people to alternate options, but Brown was looking for suggestions from her phone instead.

“I’m just trying to figure out what’s going on,” she said, explaining that she was trying to get to the SoHo neighborhood. “I don’t really take the train much,” she said. “This is why.”

A.J. McHugh, 42, of Manhattan, said he was waiting for a No. 6 train at the 33rd Street station for about 15 minutes. He said he could see a stranded train in the tunnel but decided to leave and take a bus to 77th Street.

“People had been sitting there, you could tell,” he said. “It was roasting hot.”

At Times Square, an MTA employee in an orange vest guarded the 1-2-3 line and stopped passengers from taking the stairs. “No train, no train,” she shouted.

Wilberto Roman, 39, was at the Times Square station trying to take the No. 2 train uptown, with plans to switch to the No. 4 to get to his home in the Bronx, when he was diverted.

“So I’ve got to take the A train all the way past and then take a cab home,” he said, wiping his brow and lamenting the heat. “We were sightseeing,” he said. “Now we can’t go back home.”

Kirk Polius, 28, was trying to get to his in the Bronx from the Upper East Side. He ended up at Times Square.

“I moved here almost two years ago from Houston and this is the most frustrating part of living here,” he said of the subway disruptions. “The transportation is never reliable. You either get stuck somewhere and have to transfer or you’re just sitting and waiting and waiting and waiting without any idea of what’s going on.”

And New York City officials were calling for answers:

— Mayor Bill de Blasio said on Twitter: “This kind of meltdown during a heat wave is UNACCEPTABLE. The MTA owes every single New Yorker an explanation for this. We’ve known about this dangerous weather for DAYS. There’s no excuse for why they aren’t prepared.”

— Corey Johnson, the City Council speaker, said on Twitter that the city’s Office Emergency Management was en route to the MTA’s rail control center.

— “This is completely unacceptable @MTA. Service is suspended and platforms are boiling. New York cannot function like this,” the city comptroller, Scott Stringer, said on Twitter.

This article originally appeared in The New York Times.