In a retail industry beset by problems, H&M has a doozy: A stockpile of unsold clothes worth $4 billion.

The Swedish fashion company said Thursday that the value of its global unsold inventory ballooned in the most recent quarter to 36 billion Swedish kronor ($4 billion). That's a 13% increase over the previous year.

The mass of unsold clothes, which has grown over a period of years due to weaker than expected sales growth, helped drag down profits by 28% in the first half of 2018.

"The inventory issue has now developed into a significant problem for the company," said Adam Cochrane, an analyst at Citi.

H&M (HNNMY) said it would deploy a variety of strategies, including sales, to gradually reduce the stockpile.

Cochrane said the company would offer discounts in markets where consumers respond to sales — either in store or online. The company may also sell stock to retailers that operate in countries where H&M doesn't have a presence.

While some investors might prefer a more aggressive approach to clearances, Cochrane said the company will want to pursue a balanced approach.

"It is feasible to cut prices to sell inventory but it does come with brand reputation risks attached," he said. "[Executives want to] prevent the consumer from viewing H&M as a discount led brand."

H&M said the clothing would be donated to charity or recycled if it can't be sold.

Related: H&M can't become a digital powerhouse overnight

H&M's problems extend beyond the huge pile of unsold clothes.

Analysts argue the company was too slow to get into online sales, and is now playing catchup. Shares in H&M have dropped 18% so far in 2018.

"The first half of the year has been somewhat more challenging than we initially thought, but we believe that there is a gradual improvement and that we will see a stronger second half," CEO Karl-Johan Persson said Thursday.

Retailers around the world are under pressure from changing consumer habits and online competitors such as Amazon (AMZN) and Asos.

Moody's said in a report in April that retail sector defaults hit a record high during the first three months of 2018 as the rise of e-commerce and decline of malls continues to eat away at profits.

Struggling Sears and bankrupt Claire's are among the nine retailers that defaulted on their debt during the first quarter despite the healthy overall economy. All but one of the retailers are based in the United States.

In the United Kingdom, department store John Lewis warned earlier this week that its profits would be "substantially lower than last year." Marks & Spencer announced last month it would shut 100 stores by 2022.