Toys "R" Us is planning to shutter a fifth of its U.S. stores.

The troubled retailer, which declared bankruptcy in September, is looking to close down as many as 182 outlets across the country, according to a court filing late Tuesday.

Over nearly seven decades in business, Toys "R" Us has built up 1,600 stores around the world. About 880 of them are in the U.S.

The filing Tuesday by the company's lawyers said the decision to shut so many stores was prompted by increased competition and a shift by customers toward online shopping.

Related: Retail's toughest year -- a record for store closings

The planned closures, which need court approval, are expected to begin early next month and be mostly completed by the end of April, Toys "R" Us CEO Dave Brandon said in a message to customers posted on the company's website.

"The actions we are taking are necessary to give us the best chance to emerge from our bankruptcy proceedings as a more viable and competitive company," he said.

Several other stores will be converted into co-branded Toys "R" Us and Babies "R" Us outlets, Brandon added.

Related: How the toy makers lost their Christmas magic

Toys "R" Us stores outside the U.S. are unaffected.

Melanie Teed-Murch, president of Toys "R" Us Canada, said in a statement that all 83 locations there would continue operating as usual.

The news comes after a brutal year for retailers in the U.S. in which store closings more than tripled from the previous year to nearly 7,000 closings, setting a record. There was also an increase in the number of store openings, as more successful retailers moved into vacated locations. But the year marked the first time since the Great Recession of 2009 that there was an absolute decrease in the number of U.S. stores, according to Fung Global Retail & Technology, a retail industry think tank.

Much of the problem in traditional brick-and-mortar stores was because of a shift by consumers to buying more goods online. Foot traffic in stores fell 8% last year, according to Fung.

But the problems at Toys "R" Us predate the growth of online shopping. It suffered from fierce competition and lost market share to fellow big box retailers like Walmart (WMT) and Target. It has lost nearly $2.5 billion since its last reported an annual profit five years ago, which has left it reeling under $5 billion in debt.

Unlike other retailers that have been steadily closing unprofitable locations, Toys "R" Us continued to add stores right up until recently. It had 1,691 company owned stores as of a year ago, up from 1,622 a year earlier. Still the store closings announcement was not a surprise. CEO Dave Brandon said in December that the company was studying the question of whether to close stores. The bankruptcy process makes it less costly for retailers to break lease on unprofitable locations.

The company's same-store sales fell 4.4% in the quarter ended October, with its U.S. stores experiencing a sharper drop of 7%. The toy industry at large is also facing headwinds, with key manufacturers like Lego and Mattel struggling with declining sales.

-- CNNMoney's Chris Isidore contributed to this report