New York CNN Business  — 

Fairway Market, the New York grocery staple known for its gourmet food and packed stores, said Thursday that it filed for bankruptcy with a plan to sell five stores.

Fairway, which has 14 stores, entered into what’s known as a stalking horse agreement with Village Super Market, the owner of ShopRite, to sell up to five New York stores and a distribution center for $70 million. Other companies are allowed to make bids on Fairway’s assets during the court-run process.

The company will continue to negotiate to sell its remaining stores, it said.

Fairway CEO Abel Porter said in a statement that a sale is the best way to preserve jobs and position Fairway for “long term success under new ownership.”

This is Fairway’s second bankruptcy in four years. In 2013, Fairway went public, but its stock quickly tanked. At one point, Fairway had plans to open 300 stores and become a national grocer.

On Wednesday, reports of Fairway’s collapse set off a social media frenzy from worried customers.

In recent years Fairway has faced brutal competition in New York from Whole Foods and Trader Joe’s, which erased some of its specialty and organic appeal, as well as online grocers like Amazon (AMZN) and Fresh Direct. The ease of ordering a meal for delivery in New York and the rise of meal kits have also drawn away grocery shoppers.

Walmart (WMT), the nation’s dominant grocer around much of the country, does not have a major presence in New York City. Walmart (WMT) bought Jet in 2016 and launched a same-day grocery service, but it fizzled.

Burt P. Flickinger III, managing director of Strategic Resource Group, said Fairway’s first bankruptcy was wasted and the company should have cut its stores at the time by around 30%. This latest one will have devastating consequences for workers, vendors and consumers, he said.

“New York, Chicago and Los Angeles are the three highest-priced markets for groceries. It’s really important for family-owned and operated chains like Fairway to be successful.”

Fairway is not the only supermarket to struggle in the profit-thin grocery industry. Lucky’s Market, an organic chain based in Colorado that Kroger took a stake in, said this week that it will close more than 30 stores.

The number of supermarkets in the United States declined by 1.3% last year to under 25,000 as SuperValu, Southeastern Grocers and Tops shuttered stores, according to Inmar Analytics. The number of US supermarkets will decline by 6% in the next five years, Inmar Analytics predicted.

And Fairway saying it intends to stay in business does not ensure its survival.

Recent history is full of retailers that emerged from Chapter 11 only to quickly file a second time. Many of them ended up liquidating and going out of business. RadioShack, Payless Shoes, Gymboree and American Apparel all followed that path to closure.