A deal to sell the Market Basket supermarket chain to its former CEO appeared to be imminent Friday night after the governors of New Hampshire and Massachusetts said that they are “optimistic that an agreement will be reached.”

Govs. Maggie Hassan of New Hampshire and Deval Patrick of Massachusetts said the deal would return Arthur T. Demoulas to “operating authority” for the company on an interim basis until the sale of the chain closes.

The Market Basket board would put off taking action against employees who have walked off the job in support of Demoulas, the governors said, as long as the agreement is put in writing by Sunday. Patrick and Hassan also said the deal calls for employees to return to work and any closed stores to reopen early next week.

Shortly after the governors released their statement, a spokesman for Demoulas issued one on his behalf, saying “this purchase can and should be finalized immediately.”

The statement described Demoulas’ bid as “at full price and its terms are extremely favorable to the sellers.”

“It’s time to complete this deal so we can all get back to doing what we love doing, and that is running Market Basket,” the statement concluded.

The deal, if completed, would mark the latest sharp turn in the fight over the chain’s future. Employees began taking job actions last month, hoping to see Demoulas restored to his job. The workers credit him with keeping prices at the stores low and for paying workers well, with wages above the industry standard and frequent bonuses.

Workers at the Market Basket in Biddeford were anxiously awaiting news Friday about whether Demoulas was coming back and were heartened by the news of a possible settlement to the standoff.

“The feeling is very encouraging, but we’re still waiting for confirmation from Arthur T.,” said Mark Cheney, a manager at the Biddeford store, the only Market Basket in Maine. “It kind of got us excited, but we’re trying to not be too excited.”

Cheney said the fight to restore control of the company to Demoulas united workers across the chain. He noted that store shelves were often near empty because warehouse workers in Tewksbury, Massachusetts, disrupted shipments. Customers, he said, showed their support by staying away, but he thinks they will come flocking back if a deal to sell the chain to Arthur T. Demoulas is completed.

“I think they’re all eager to come back – and we’ll get a lot more,” Cheney said Friday night.

Other workers spent Friday on pins and needles as negotiations continued and an unofficial deadline for reaching a deal loomed.

“All our stomachs are upside-down,” clerk Larry Giguere said while standing in front of the store holding a protest sign. “Nobody’s sleeping.”

It was unclear whether other bidders submitted final offers Friday. The Delhaize Group SA, the parent of Hannaford Supermarkets, has continued to express interest in buying the company, according to the Boston Globe, but the governor’s statement suggested that the negotiations centered around Demoulas’ bid.

The company’s board – which had told Patrick that it hoped to have a sale agreement in place by the end of this week – was expected to meet to discuss the final bids and the broader crisis facing the company, which is losing millions of dollars a week because of an employee walkout that has brought its operations to a halt.

Tewksbury, Mass.-based Demoulas Super Markets Inc., which runs 71 Market Basket stores in New England, has been in turmoil for more than five weeks following the ouster of Demoulas, whose employee-friendly demeanor and policies have engendered intense loyalty among the company’s work force. The family-owned company’s board is narrowly controlled by Demoulas’ rival cousin, Arthur S. Demoulas.

Analysts have said that Market Basket is losing millions of dollars a week and must act quickly to resolve a leadership dispute that has led to the employee walkouts and customer boycott. The disruption of regular deliveries to the stores has left many shelves empty, especially in the meat, produce and bakery aisles.

Thousands of part-time employees, including about 270 in Biddeford, have been taken off the work schedule indefinitely.

They could begin working again as soon as this weekend if a sale agreement is reached, employees at the Biddeford store said. Produce, meats, bread and other highly perishable goods could return to shelves within a day or two if regular deliveries resume.

But getting customers to return could take more time, Giguere said.

Even if the company’s majority shareholders sell to Arthur T., the company may have trouble restoring employee and consumer confidence in the brand, according to Jeff Metzger, publisher of Columbia, Maryland-based Food Trade News. Some of the damage from the recent turmoil may be impossible to undo, he has said.

The company will need to make a big marketing push to let shoppers know that the ownership issue has been resolved, Giguere said.

“They’re going to have a grand reopening,” he said.

The Market Basket saga has dragged on for nearly two months, with Arthur T. and his rivals on the board publicly exchanging barbs via news releases and written statements.

Since Arthur T. was fired on June 22, hundreds of employees have walked off the job and held mass protests, food deliveries have virtually stopped, and the vast majority of customers have boycotted stores.

Arthur T., whose side of the family owns 49.5 percent of the company, has offered an undisclosed sum to buy out the majority-owning rival faction controlled by his cousin. Analysts believe a sale to Arthur T. would revive the business and bring former customers and employees back to the company, although it likely would saddle Market Basket with millions in additional debt.

While the board has said it wants to sell to the former president, Arthur T. had described the proposed sale conditions as unrealistic and unacceptable.

He is a hero to many in the company, and also made customers happy by instituting across-the-board price cuts that have kept Market Basket prices low.

The internal dispute at Market Basket goes back decades and came to a head in 2013, when the Demoulas cousins clashed over the company’s future business strategy. Arthur T. wanted to use its cash reserves to open more stores, while Arthur S. insisted that the money be paid out in dividends to the family-owned company’s shareholders. The dispute ended up in court, where Arthur S. won a judgment to distribute $300 million to the shareholders.

Regardless of whether the board sells to Arthur T., the solidarity exhibited by hourly workers, managers and customers throughout the crisis will not be soon forgotten, furloughed assistant clerk Lynne Schultz said.

“They say we’re rewriting history, because this has never been done,” she said.