(Reuters) - Toys 'R' Us Inc IPO-TOYS.N got court permission on Tuesday to borrow more than $2 billion to start paying suppliers so it can stock up on items like Lego building blocks and Barbie dolls for the holiday season, a day after it filed for bankruptcy.

The Chapter 11 filing by the biggest U.S. toy store chain, to restructure $5 billion of long-term debt, is among the largest ever by a specialty retailer and casts doubt over the future of the company’s 64,000 employees and nearly 1,600 stores, which remain open.

The collapse came swiftly.

News reports this month that the company hired a law firm that specializes in corporate restructuring and was seeking a bankruptcy loan set off “a dangerous game of dominoes,” David Brandon, the company’s chief executive and chairman, said in a court filing.

Ten days later, nearly all the company’s vendors refused to ship products without cash in advance, forcing Toys ‘R’ Us to scramble to raise $1 billion for its suppliers, according to court filings.

The timing could not be worse.

Toys ‘R’ Us is building inventory for the holiday season and fourth quarter, which accounts for 40 percent of net sales.

Slideshow ( 3 images )

The company said it received a commitment for up to $3.1 billion in debtor-in-possession financing from lenders including a bank syndicate led by JPMorgan Chase & Co JPM.N and certain existing lenders.

The Wayne, New Jersey-based company, which also operates the Babies ‘R’ Us chain, can return to court to seek approval to borrow the entire loan commitment.

Brandon said in the court filings that he hoped Chapter 11 would enable the company to address the financial constraints that “have held us back” in a “lasting and effective way.”

The chain could have avoided bankruptcy for another two years but “it would have delayed the inevitable,” according to Tuesday court testimony by David Kurtz of Lazard, an investment bank advising Toys ‘R’ Us. He said the company’s board realized it should file now, raise significant cash and reverse years of underinvestment.

Toys ‘R’ Us, which like other traditional bricks-and-mortar retailers has struggled as more and more consumers shop online, is taking steps to try and entice customers to its stores.

By 2022, the company plans to spend around $1 billion to transform its big box stores by adding event space, increasing staff and wages for in-store product demonstrations and combining its flagship stores with Babies ‘R’ Us stores.

Slideshow ( 3 images )

Brandon said Toys 'R' Us was not going to engage in an "unrelenting race to the bottom" by trying to slash prices to compete with Amazon.com Inc AMZN.O, the only company that sells more toys.

“It’s the only showroom available. This company offers something no one else can,” Joshua Sussberg, an attorney with the company’s law firm, Kirkland & Ellis, told the U.S. Bankruptcy Court in Richmond, Virginia.

But Matthew Hudak, a senior toys and games analyst at Euromonitor International, said the company would struggle to cash in on trends in toy sales. Sales of video game and robotic products have moved online, hobby board games tend to be sold in local specialty stores, and collectible action figures are found in Target Corp TGT.N and Wal-Mart Stores Inc WMT.N and convenience stores.

Share prices of toy makers rose on Tuesday after sliding in recent days when investors grew worried whether Toys ‘R’ Us could pay for holiday merchandise.

Mattel Inc MAT.O closed up 1.2 percent and Hasbro Inc HAS.O added 1.9 percent.

Isaac Larian, chief executive officer of MGA Entertainment Inc, the country’s biggest privately owned toy company, said he had shipped holiday goods to Toys ‘R’ Us, and would continue to do so.

“I’ve always said that if there’s no Toys ‘R’ Us, there is no toy business. I really believe that,” said Larian.

Toys 'R' Us is saddled with debt from a $6.6-billion buyout in 2005, led by KKR & Co LP KKR.N and Bain Capital LP, together with real estate investment trust Vornado Realty Trust VNO.N.

The company said its Canadian unit intends to seek protection in parallel proceedings under the Companies’ Creditors Arrangement Act (CCAA) in the Ontario Superior Court of Justice.

Operations outside of the United States and Canada, including about 255 licensed stores and joint venture partnerships in Asia, which are separate entities, are not part of the bankruptcy proceedings, Toys ‘R’ Us said.

More than a dozen significant retail chains have filed for bankruptcy this year. Among them were Perfumania Inc, apparel chains rue21 Inc and Gymboree Corp, discount shoe chain Payless Holdings LLC and designer clothing chain BCBG Max Azria Global Holdings LLC.

Major retailers, including Macy's Inc M.N and Sears Holding Corp SHLD.O, have closed hundreds of locations as they struggle to compete with discounters such as Wal-Mart and Amazon.