Activist investor Carl Icahn has triumphed in a bidding war to acquire the Pep Boys — Manny, Moe & Jack, the Philadelphia-based auto parts chain. Icahn’s holding company and Pep Boys announced the agreement Wednesday.

Icahn Enterprises agreed to buy the company at $1.03 billion, or $18.50 per share, in an all-cash transaction. That sum topped a final offer of $17 a share from Japanese auto and truck parts manufacturer Bridgestone.

“This was a terrific opportunity to leverage the financial and industry knowledge of Icahn Enterprises to the benefit of Pep Boys’ customers, manufacturer partners and employees and further bolster our U.S. automotive footprint,” the two parties said in a joint statement.

Pep Boys CEO Scott Sider said he was “very pleased to have this agreement, which delivers outstanding value to Pep Boys’ shareholders, provides new opportunities for Pep Boys employees and allows Pep Boys to benefit from the significant expertise and resources of Icahn Enterprises.”

The transaction is expected to close in the first quarter of 2016.

The auto parts retailer put itself on the market in June. It then accepted an offer from Bridgestone in October to be acquired for $15 a share. Earlier this month, the famed activist investor Icahn disclosed a 12.12 percent stake in Pep Boys and offered to buy the company at $15.50 per share, triggering a bidding war. Over the last few weeks, Bridgestone matched Icahn’s offer at $15.50, was outbid again and finally offered $17. On Tuesday night, it said it would not increase that offer.

As part of the deal with Pep Boys, Icahn will pay a termination fee of $39.5 million to Bridgestone.

Pep Boys stock (NYSE:PBY) was down 3 percent Wednesday morning, trading at $18.37 per share. The company has more than 800 stores in 35 states and Puerto Rico.

Icahn Enterprises stock (NASDAQ:IEP) was down 1.33 percent to $60.19.