Two of the nation's largest drug store chains want to merge, a deal that's certain to face intense scrutiny from federal regulators worried about its potential harm to consumers.

Walgreens Boots Alliance, the company that owns Walgreens drugstores, said yesterday that it has agreed to buy Rite Aid for about $9 a share, in a deal worth about $17 billion.

The deal would help Walgreens expand its footprint geographically, creating a single retail chain with almost 13,000 stores around the country.

"Today's announcement is another step in Walgreens Boots Alliance's global development and continues our profitable growth strategy," said Stefano Pessina, CEO of Walgreens Boots.

The deal will have to be approved by federal regulators, who will try to judge its impact on competition, said David Balto, a former official at the Federal Trade Commission.

"What they're going to look for, ultimately, is will consumers suffer because of higher prices or worse service because of the transaction?" Balto said in an interview with NPR. He added:

"These two firms are very aggressive competitors, and in the markets where they meet, it really makes a big headache for consumers. Permitting this merger would be a tremendous headache for consumers. They're going to suffer in their pocketbook."

As a condition of approving the deal, regulators could force Walgreens to divest itself of some of its stores in states such as California, New York and Massachusetts, where they are most concentrated.

The deal will give Walgreens a bit more leverage in negotiating drug prices with large drug companies and insurers, says Vishnu Lekraj, senior analyst at Morningstar.

But he believes the impact will be limited.

Drugstore chains such as Walgreens are having to contend with a lot of new competitors — grocery stores, online pharmacies and big retail chains such as Wal-Mart and Target.

"There's just so much, so many options out there," Lekraj told NPR.

Meanwhile, he said, they have to deal with pharmacy benefit managers, which are large companies hired by insurers to drive down the cost of drugs:

"When it comes to negotiating reimbursement rates with insurers and large PBMs, they just don't have a lot of power, and they probably will not be able to gain the power to push back."Copyright 2016 NPR. To see more, visit http://www.npr.org/.