The Research in Motion RIM campus in Waterloo, Candada. BlackBerry warned that it expects to report a huge second-quarter operating loss next week and that it plans to cut more than a third of its workforce. (Mark Blinch/Reuters)

The BlackBerry, once the most coveted gadget of Washington’s political and business elite, appears to be near extinction as its parent company on Friday announced nearly $1 billion in losses for the second quarter.

It was the latest of dire announcements from BlackBerry in recent days as it falters in its competition with popular smartphones such as Samsung’s Galaxy and Apple’s iPhone.

BlackBerry said it would lay off 4,500 people, or 40 percent of its staff, and slash operational expenses in half. The company earlier in the week said it was seeking “strategic alternatives” that could include the sale of the firm.

The second quarter was particularly grim for the Ottawa-based company, formerly known as Research in Motion. The firm said that most of its writedown would come from its inability to clear stockpiles of its latest BlackBerry 10 device.

Shares of BlackBerry were halted after dropping 17.1 percent to close at $8.73 on the news.

“We are implementing the difficult, but necessary operational changes announced today to address our position in a maturing and more competitive industry, and to drive the company toward profitability,” Thorsten Heins, BlackBerry’s president, said in a statement.

Heins said BlackBerry will focus on enterprise markets, where it may benefit from the perception of providing greater security than other devices.

“This puts us squarely on target with the customers that helped build BlackBerry into the leading brand today for enterprise security, manageability and reliability,” he said.

That reputation also won over government clients such as the White House, the Defense Department and other agencies that had touted BlackBerry’s efforts to encrypt e-mail. But bowing to consumer interests, the federal agencies in recent years loosened their policies, allowing workers to connect work e-mail to their own devices. Agencies such as the Defense Department began to distribute a wider variety of smartphones to workers and allowed them in May to use the iPhone and iPad.

Phones using Google’s Android software and Apple’s iPhone dominate the smartphone market. BlackBerry has just 3 percent of the market, after Windows OS phones, according to a second-quarter report by IDC research.

BlackBerry could still be an attractive takeover target with $2.6 billion in cash, no debt and coveted software and hardware patents, analysts say.

Follow The Post’s new tech blog, The Switch, where technology and policy connect.