NEW YORK — Walgreen Co. said Wednesday that it will not shift the drugstore chain’s legal address out of the United States to avoid taxes because the move could have been challenged under Internal Revenue Service tax-abuse rules.

Walgreen in a statement Wednesday said it will keep its legal address in Illinois when it completes its takeover of Switzerland’s Alliance Boots.

Deerfield, Illinois-based Walgreen would have had to change the terms of its 2012 agreement to buy Boots to give the combined company a non-U.S. domicile, said Michael Polzin, a spokesman for Walgreen. Those changes would have to be “commercially driven,” not tax-driven, he said.

“Without that, you run a significant risk of a successful IRS challenge,” Polzin said.

Shareholders including Barry Rosenstein’s Jana Partners urged Walgreen to use the transaction to move abroad.

The shift might have saved $4 billion in taxes over five years, according to Americans for Tax Fairness, a Washington-based advocacy group that urged Walgreen not to carry out such a transaction.

U.S. companies can become foreign for tax purposes – a technique known as inversion – if they merge with a foreign company whose shareholders end up owning at least 20 percent of the combined enterprise. To meet that threshold, Walgreen would have had to change the financial terms of its 2012 agreement with Boots.

That change would have been vulnerable to IRS anti-abuse rules, Polzin said.

“Our inversion process would be very different from what you’re seeing from all these other companies,” Polzin said. “They acquire another company and from the outset they design it as an inversion.”

Walgreen Chief Executive Officer Gregory Wasson addressed such concerns during a conference call Wednesday. He said the board considered an inversion and wasn’t able to “ensure that the transaction could withstand almost certain, intense, protracted IRS scrutiny.”

He said a dispute with the IRS over the matter could last three to 10 years.

Wasson also cited “the potential consumer backlash and political ramifications” of the move as being part of the company’s decision not to carry out the inversion.

In the statement Wednesday, Walgreen said it exercised an option to pay $15.3 billion for the 55 percent of Boots it doesn’t already own.