Walgreens Boots Alliance Inc. (NasdaqL WBA) is scrapping its takeover of rival Rite Aid Corp. (NYSE: RAD) and instead will buy a smaller piece of the drugstore chain, after the original deal was doomed by U.S. antitrust problems.

The new agreement ends a saga that dragged on for more than a year and a half as the companies struggled to get approval from regulators. On Thursday, June 29, they said they would scrap the $7.37 billion takeover, and instead Walgreens will pay $5.18 billion to buy 2,186 stores, leaving Rite Aid as a regional chain.

“This deal is much simpler,” Walgreens CEO Stefano Pessina said on a conference call. “It is an asset deal so it is less controversial.”

The new agreement may be a way to finally satisfy the U.S. Federal Trade Commission. The FTC had been reviewing the original takeover and reportedly expressed skepticism that there would be enough competition left in the drugstore market, even with a plan to sell as many as 1,200 Rite Aid stores to Fred’s Inc., a smaller chain.

Fred’s, which will no longer get the divested stores that would have been part of the original deal, dropped 23 percent to $9.50 at 10:01 a.m. in New York.

“This is a disappointing outcome,” said Michael Bloom, Fred’s CEO, in a statement. “However, the termination of the transaction has no impact on the company’s transformation strategy or our ability to execute.”

Rite Aid shares plunged as well, and were down 25 percent to $2.95. Walgreens rose 2.8 percent to $79.26.

During the review of the previous deal, Walgreens likely learned which store locations raised concerns with the FTC and is probably just buying those stores where there’s no competition problem, said David Kully, an antitrust lawyer at Holland & Knight LLP in Washington.

“If Walgreens only buys the ones where the FTC saw no competitive problems, then the FTC should have no reason to object,” he said. “It seems kind of an ingenious solution to this.” Walgreens said it had considered the FTC’s review.

“You should assume we have taken account of specific feedback from the agency,” Marco Pagni, general counsel for Walgreens, said on the call discussing the new deal.

This is the second time Walgreens has altered its plan to buy Rite Aid stores. The first agreement announced in October 2015 was for $9 a share of Rite Aid stock, or $9.4 billion. A revised deal announced in January cut the agreement to $6.50 to $7 a share, or between $6.84 billion and $7.37 billion, depending on how many stores changed hands.

The FTC said in a statement that it will review the new transaction and is no longer looking at the previous deal because the companies withdrew their filing with the agency. The FTC said it investigated “a number of divestiture proposals” by the companies.

Under the current plan, Walgreens is no longer purchasing Rite Aid at all, but merely acquiring stores and other assets from the company. Rite Aid will receive a termination fee of $325 million in addition to the purchase price.

The now-terminated acquisition of Rite Aid would have vaulted the combined company past CVS Health Corp. to become the leading drugstore chain by number of stores. In May, Walgreens moved to force a U.S. decision on the matter, which was due by July 7.

"It’s a clear positive for Walgreens,” said Jeff Jonas, a portfolio manager at Gabelli & Co. which holds less than 1 percent of Rite Aid and Walgreens shares. “Rite Aid was always going to be a big turnaround story, now it’s just easier to do it with a smaller number of stores, it frees up the capital for the buyback.”

Rite Aid said it will use proceeds to pay down debt, and the bonds gained on that news. Its 6.75 percent unsecured notes due in 2021 rose as much as 4 cents on the dollar to 102.875, according to Trace, the bond-price reporting system of the Financial Industry Regulatory Authority. The 7.7 percent notes due in 2027 were trading as high as 102.75 Thursday morning in New York.

Two FTC commissioners were scheduled to meet behind closed doors at 10 a.m. to consider undisclosed law enforcement matters. Rite Aid, in its statement Thursday, said it received feedback from the FTC “that led the company to believe that the parties would not have obtained FTC clearance to consummate the merger.”

The original agreement would have been for about 3,336 stores “making this agreement about one-third smaller and more likely to pass regulatory scrutiny in our view,” Leerink Partners analyst David Larsen said in a note to clients.

Walgreens said it will begin acquiring the Rite Aid stores and related assets over a period of approximately six months, and intends to convert the stores to the Walgreens brand over time.

Separately, Walgreens reported adjusted earnings of $1.33 a share for the quarter ended May 31, beating analyst average expectations of $1.30 a share. It also narrowed the range of its adjusted earnings projection for the year to $4.98 to $5.08 per share, from a previous range of $4.90 to $5.08 a share.