It was once so addictive it inspired the nickname "CrackBerry".

President Barack Obama confessed to being among the millions of devotees who could not bear to stop tapping feverishly away on its tiny keyboard. Madonna said she slept with hers under her pillow.

Then came the iPhone. Users newly addicted to Facebook and photo-sharing and Angry Birds started flirting with the opposition.

And as more smartphones flooded the market with their supersize Samsung screens and thousands of apps, the BlackBerry failed to keep up.

This year's launch of BlackBerry 10, its revamped operating system, and fancier new devices - the touchscreen Z10 and Q10 for keyboard loyalists - was supposed to rejuvenate the brand and lure customers.

But the much-delayed phones have failed to turn the company around. At their peak in the autumn of 2009, BlackBerry's smartphones enjoyed global market share of over 20%, says says Mike Walkley, an analyst with Canaccord Genuity. That has since evaporated to just 1.5%.

Now the company says it will lay off 4,500 employees, or 40% of its global workforce, as it tries to slash costs by 50% and shift its focus back to competing mainly for the business customers most loyal to its brand.

A week earlier than expected, BlackBerry surprised the market by reporting yesterday that it lost nearly 1 billion dollars in the second quarter. It is booking over 900 million dollars in charges to write down the value of its glut of unsold smartphones.

Shares were halted pending the news. They plunged as low as 8.01 dollars when the stock reopened for trading, before closing down 17% at 8.72 dollars.

"This is the end of the BlackBerry as we know it," BGC analyst Colin Gillis said from New York.

"This is a major pivot. They are cutting half of their employees and they're going to focus on becoming a niche player focused on the enterprise."

He said he does not expect to see a BlackBerry advertisement on television again.

BlackBerry had been scheduled to release earnings next week. But the Waterloo, Ontario company surprised the market late yesterday afternoon by announcing that it expects to post a staggering loss of 950 million to 995 million dollars for the quarter.

BlackBerry said it wants to slash operating costs in half by the first quarter of 2015 so cutting its global headcount to 7,000 total employees is necessary. The company let 5,000 people go last year.

"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," said Thorsten Heins, president and chief executive of BlackBerry.

BlackBerry said last month that it would consider selling itself. The company reiterated yesterday that a special committee of its board of directors continues to evaluate all options.

"Going forward, we plan to refocus our offering on our end-to-end solution of hardware, software and services for enterprises and the productive, professional end user," said Mr Heins.

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

BlackBerry, formerly known as RIM, was once Canada's most valuable company with a market value of 83 billion dollars in June 2008, but the stock has plummeted from over 140 dollars a share to less than 9 dollars.

Its decline is evoking memories of Nortel, another Canadian tech giant, which ended up declaring bankruptcy in 2009.

Of BlackBerry's remaining employees, thousands live in Waterloo, a university town 90 minutes' drive from Toronto, where everyone seems to know someone who works for the company.

"Our thoughts are with those who have lost their jobs at BlackBerry, it is always a cause for concern for our Government," Canadian Industry Minister James Moore said.