* Bain-led bid worth some $22 bln -sources
* Bain consortium includes SK Hynix, Apple and Dell
* Western Digital wouldn't agree to terms on future stake- source (Adds analyst comment and details of the deal)
TOKYO, Sept 20 (Reuters) - Japan's embattled Toshiba Corp has selected a group led by U.S. private equity firm Bain Capital to buy its prized memory chip unit, three people with knowledge of the talks said on Wednesday, a last-minute dramatic twist to a highly contentious auction.
But it's unclear whether the decision by Toshiba's board will mean the sale will now proceed smoothly, as rival suitor Western Digital Corp has initiated legal action, arguing no deal can be done without its consent due to its position as Toshiba's joint venture chip partner.
The Bain-led offer for the world's No. 2 producer of NAND semiconductors is worth some $22 billion, sources have said.
It has partnered with South Korea's SK Hynix Inc and brought in U.S. buyers of Toshiba chips such as Apple Inc and Dell Inc to bolster its bid. Kingston Technology and Seagate Technology Plc are also part of the group.
The make-up of the consortium could spell trouble ahead, said Hideki Yasuda, an analyst at Ace Research Institute.
"The large number of stakeholders could complicate decision-making and slow down key investment decisions," he said, adding that the participation of Toshiba clients would also sap the ability of the chips business to negotiate competitively on pricing.
Bain's win, first reported by Reuters, has been hard fought as wrangling went down to the wire and late on Tuesday the Western Digital-backed consortium, which includes KKR & Co LP , appeared to be in the lead, sources said.
But the California-based firm would not agree to limits to any future stake in the chip business that had been demanded by Toshiba, said one person briefed on the matter.
Sources declined to be identified as they were not authorised to speak about discussions on the sale.
Toshiba declined to comment. A representative for Bain was not immediately available for comment while SK Hynix declined to comment.
After a slew of revised bids and changing alliances among suitors, an agreement comes not a moment too soon for Toshiba. It has has been under pressure from its lenders to clinch a deal this month to ensure enough time for regulatory reviews so that it can finish the sale by the end of the financial year.
If it doesn't, it won't have the billions of dollars it needs to plug a huge hole in its finances caused by its now bankrupt U.S. nuclear unit Westinghouse, and could be delisted.
Even without that problem staring it in the face, the semiconductor business requires huge amounts of investment and Toshiba's chip unit runs the danger of losing its competitive ability as rivals roll out big capital spending plans.
A representative for Western Digital was not immediately available for comment.
The U.S. firm has already taken the dispute to the International Court of Arbitration to prevent the sale and a source with knowledge of the matter has previously said it is prepared to seek an immediate court injunction should the deal not go its way.
The Bain-led group had at one stage been chosen as preferred bidder but those talks lapsed as Japan government investors who had been part of that consortium told Toshiba they were reluctant to close a deal in the face of legal challenges posed by Western Digital.
The Bain consortium has since revised the offer, aiming to get around that problem by inviting the state-backed investors - the Innovation Network Corp of Japan (INCJ) and the Development Bank of Japan - to invest in the business only after any arbitration with Western Digital is settled.
But sources familiar with the talks have said it remains unclear if INCJ will commit to joining the consortium even when the legal dispute is resolved, casting uncertainty over the whether Japanese government will be able to prevail in its desire to have the chip business mainly under domestic control.
(Reporting by Taro Fuse and Kentaro Hamada; Additional reporting by Makiko Yamazaki, Junko Fujita and Tom Wilson in Tokyo, and Joyce Lee in Seoul; Writing by Makiko Yamazaki; Editing by Edwina Gibbs)