Rite Aid
Rite Aid and Albertsons have agreed to end their merger just before shareholders were scheduled to vote on the deal. A Rite Aid is pictured shown Oct. 27, 2015 in Boulder, Colorado. Justin Sullivan/Getty Images

Rite Aid Corp. has agreed with Albertsons Companies Inc. to cancel their proposed merger just before shareholders were scheduled to vote over the deal. The two companies announced in a statement Wednesday that they would put an end to their proposed merger because of opposition from investors and shareholders.

The $24 billion deal, announced in February, would have seen grocer Albertsons acquire drugstore chain Rite Aid. However, in the weeks leading up to the agreement, two prominent proxy advisors suggested that shareholders vote against the plan.

The pharmacy chain said it has canceled a special shareholders meeting on the deal that was set to take place on Thursday. According to the statement, there won’t be a termination fee for either company for ending the agreement.

"While we believed in the merits of the combination with Albertsons, we have heard the views expressed by our stockholders and are committed to moving forward and executing our strategic plan as a standalone company," Rite Aid Chairman and CEO John Standley said in a statement.

Neil Saunders, Managing Director of analysis firm GlobalData Retail, told CNN that the proposed merger had an "overly optimistic view."

"There was some logic in that the deal would have given Albertsons more scale in the high-growth pharmacy and health space," he said. "It would have also granted it access to some geographic areas it does not currently serve with a pharmacy offer."

Investment advisory firms Glass Lewis and Institutional Shareholder Services urged investors to vote against the merger in July.

"Strategically, the proposed merger appears to be a step in the right direction, as it provides [Rite Aid] with increased scale and diversification. However, the transaction would introduce a new set of risks associated with the grocery business, and the combined company's leverage could limit investment in two evolving business environments," ISS wrote.

Rite Aid said its board is "evaluating governance changes at the company" and it will "continue to engage with stockholders" during those evaluations.

In 2015, Walgreens attempted to buy Rite Aid, but it fell through because federal regulators cited antitrust laws, according to CNN Money. Walgreens, instead, agreed to buy 2,186 Rite Aid stores in a deal worth $5.2 billion.