“This is a cash flow problem for Prepa,” he said.

But Mr. Ramos told legislators on Tuesday that he went with the private company because he did not have the resources to find lodging for workers borrowed from other utilities. But emails released this week by the House Committee on Natural Resources show that Whitefish could not find housing, either.

“There has to be some level of corruption. Otherwise, how can somebody be so incompetent?” said Ramon J. Cruz, a former member of Puerto Rico’s energy commission who has been following the issue closely.

It had been a rough week for Mr. Ramos.

On Monday, The New York Times reported that some of the subcontractors Whitefish had hired to do the work — people Prepa could have hired itself — were earning just $42 an hour. At the Senate hearing on Tuesday, Mr. Ramos fended off accusations of price gouging.

On Wednesday, Mr. Ramos and the governor proudly hailed an important milestone: The company had finally reached 50 percent of its power capacity. Minutes later, a key line failed, again plunging the northern half of the island into darkness. Another line failed on Thursday.

Nearly two months after the storm, the grid is generating power at 45 percent of capacity. Most homes are without power and traffic lights remain out. Several hospitals are still running on generators and thousands of small businesses are closed.

On Friday, a local newspaper reported that Mr. Ramos had hired a friend who was once implicated in a federal criminal case to help advise the company. Mr. Ramos posted a cheerful technical update in a video on Facebook defending the consultant, whom he described as an experienced electrical engineer. Twenty minutes later, the company announced that Mr. Ramos had quit.

“It’s shocking that it took so long,” said Austin Evers, executive director of American Oversight, a liberal watchdog group that is investigating the contract. “And I also think it’s critical that investigations continue, because it’s not credible that Mr. Ramos was the only person involved in this.”