Supervalu Inc. at last succumbed to the 2008 recession.

The Eden Prairie company — which agreed on Thursday to be sold to another food wholesaler, United Natural Foods Inc., in a $2.9 billion deal — spent a decade trying to overcome the downturn's effect on a huge bet it made.

In early 2006, a bit more than two years before recession hit, Supervalu spent $12 billion to buy more than 1,100 stores of Albertsons Inc., at the time the nation's second-largest chain of grocery stores. When the economy collapsed, Supervalu still had more than $6 billion in debt and little room to maneuver financially as customers flocked to discounters.

"If we didn't go through 2008-09, it's probably not that big a deal," said Rob Plaza, an analyst at Key Private Bank in Cleveland, who wrote critically of the deal when it was forming in 2005. "The recession, how deep it was, hurt everybody. People were pushed further to the discounters and away from traditional grocery stores. When you [borrow] to buy it, it puts pressure on the margins. It's a vicious cycle."

Over the last decade, Supervalu's stock lost more than 90 percent of its value as it eventually sold the Albertsons assets as well as some of the grocery chains it owned before that deal. Few other food-related companies have fared as poorly over a decade, while the overall stock market has more than tripled in value.

This past year, Supervalu's difficulties led a New York investment firm, Blackwells LLC, to mount a proxy challenge. Shareholders are scheduled to vote on Aug. 16 whether to replace the company's board of directors with six candidates proposed by Blackwells.

That battle may be squelched by the company's sale to United Natural Foods. Blackwells declined to comment Thursday. Other bids may also emerge for the firm, though Supervalu and United Natural Foods said they aim to close the deal later this year.

In a sign of how the 2006 Albertsons deal still looms over Supervalu, $1.6 billion of its $2.9 billion sale to United Natural Foods is the value of Supervalu debt that United Natural Foods agreed to assume and eventually pay off.

The remaining $1.3 billion represents the cash that United Natural Foods is paying for Supervalu's stock. The buyer offered $32.50 for each Supervalu share, a 67 percent premium over the Wednesday closing price of $19.45.

When the Albertsons deal closed in June 2006, Supervalu's then-Chief Executive Jeff Noddle called it "the largest day in Supervalu's history," which stretched back to mom-and-pop distributors in Minneapolis in the 1870s and included the arrival of frozen foods in the 1930s and buildup of Cub Foods superstores in the 1980s.

With the Albertsons stores, Supervalu for a time was the nation's third-largest seller of groceries after Walmart and Kroger. Its annual revenue climbed to $44 billion, more than 3M or Best Buy bring in today. In mid-2007, the deal appeared to be working as sales and profits rose. But by the end of that year, U.S. consumers were already tightening their belts and Noddle was warning that the company's stores were losing customers to discounters.

Noddle left the company in 2009, and pressure continued to build on the firm as smartphones proliferated, leading to new pressure to invest in digital capabilities and delivery services. Same-store sales fell as Supervalu's ability to spend to update stores was constrained.

In early 2013, the company sold most of the Albertsons assets for about $3 billion, well below what it paid for them but enough to reduce its debt burden significantly. In the years since, Supervalu raised more funds by selling several of its regional retail chains, including the largest, St. Louis-based Sav-A-Lot, in 2016.

The company's wholesale business — anchored by distribution centers in dozens of states, including its largest in Hopkins, at more than 2 million square feet in size — remained profitable and serves more than 3,300 grocery stores around the country. In the Twin Cities, in addition to Cub, Supervalu supplies Lunds & Byerlys, Jerry's Foods and some smaller stores.

Under Chief Executive Mark Gross, who has led Supervalu since 2016, the company made several purchases of other wholesalers, including Unified Grocers and Associated Grocers in 2017.

"Today's announcement follows a more than two-year strategic transformation and fundamental shift to return Supervalu to its wholesale roots," Gross said. "Over this period, we've added $5 billion in run-rate sales, we've improved our balance sheet, and we've reduced our retail footprint, all critical steps that made this deal possible."

United Natural Foods said it will sell the remaining grocery chains that Supervalu owns. The fate of those stores figured heavily in the battle between Supervalu and Blackwells, the activist investor. In a Jan. 17 meeting at the company's headquarters, Blackwells principal Jason Aintabi proposed that Supervalu give its store chains to the investment firm to dispose of. Supervalu executives rejected the idea.