TOKYO — Mt. Gox, the troubled exchange for the virtual currency Bitcoin, filed for bankruptcy protection on Friday and said that it might have lost 750,000 of its customers’ coins, essentially all of them, in a hacking attack.

The Tokyo-based exchange, which warned this month of a software flaw that may have allowed hackers to defraud it of Bitcoins, had halted all trading this week.

Mark Karpeles, the company’s chief executive, wearing a suit instead of his usual T-shirt, bowed in contrition and apologized in Japanese at a press conference in Tokyo.