Hewlett-Packard Co. said Tuesday that it had taken an $8.8 billion accounting charge, after discovering "serious accounting improprieties" and "outright misrepresentations" at Autonomy, a British software maker that it bought for $10 billion last year.

It is a major setback for HP, which has been struggling to turn around its operations and remake its business.

The charge essentially wiped out its profit. In the latest quarter, HP reported a net loss of $6.9 billion, compared with a $200 million profit in the period a year earlier. The company said the improprieties and misrepresentations took place just before the acquisition, and accounted for the majority of the charges in the quarter, more than $5 billion.

HP bought Autonomy in the summer of 2011 in an attempt to bolster its presence in the enterprise software market and catch up with rivals like IBM. The takeover was the brainchild of Leo Apotheker, HP's chief executive at the time, and was criticized within Silicon Valley as a hugely expensive blunder.

Apotheker resigned a month later. The management shake-up came about one year after Mark Hurd was forced to step down as the head of HP after questions were raised about his relationship with a female contract employee.

HP said that Autonomy, in some instances, sold hardware like servers, which has higher associated costs. But the company booked these as software sales. It had the effect of underplaying the company's expenses and inflating the margins.

HP also contends that Autonomy relied on value-added resellers, middlemen who sold software on behalf of the company. Those middlemen reported sales to customers that didn't actually exist, according to HP.

HP also claims that that Autonomy was taking licensing revenue upfront, before receiving the money. That improper assignment of sales inflated the company's gross profit margins upfront, before receiving the money. It had the effect, the company said, of significantly bolstering Autonomy's gross margin.

HP turned over its findings to the U.S. Securities and Exchange Commission and the Serious Fraud Office in Britain within the past week.

The former management team of Autonomy, which includes the company's founder, Mike Lynch, rejected HP claims about the accounting issues.

John Schultz, the general counsel of HP, would not detail the company's future legal strategy but said, "We intend to be aggressive in recovering value for our shareholders."