It’s never fun when a once-great tech company like BlackBerry Ltd.  (TSX:BB)(NASDAQ:BBRY) continues to experience failure time and time again. What’s so frustrating is that BlackBerry has the potential to be an incredible tech company again, but it needs to get out of its own way.

The way to do that is to sell its hardware division and become a pure-play software company. If it were to do that, I believe BlackBerry could have its brightest years ahead of it.

And here’s why…

In the second quarter, the company sold 800,000 devices. By the third quarter, that dropped to 700,000. Fast forward to the most recent quarter, and the number was down to 600,000. While CEO John Chen blamed delays with Verizon Communications Inc. for the low numbers, the fact remains: not enough people are buying BlackBerry devices.

Consider that its hardware division revenue was $184 million in the most recent quarter, down 33% from US$274 million in Q4 2015. Its hardware division continues to remain unprofitable; it’s not growing like management expected, and unless millions of people are going to buy Android BlackBerrys, I imagine Chen will have to commit to his promise to give up on hardware.

And it will not have come soon enough. BlackBerry is spending too much money trying to resuscitate its hardware division. More than 65% of the company’s R&D is dedicated to hardware, which is a waste of money.

Fortunately, if it were to refocus on software, the company would see significant growth. Its software and services business saw a 76% increase in revenue year over year to US$130 million. On top of that, the company revealed that 70% of that revenue was recurring. In its announcement press release, the company said, “BlackBerry had over 3,600 enterprise customer wins in the quarter.”

I expect revenue to grow in the software and services division in the cyber-security areas in particular. According to one report, the global cost of cyber crime in 2015 was estimated to be around US$400 billion. That’s only going to go up.

BlackBerry excels at security, making it a favourite in preventing cyber attacks. It recently acquired Encription Ltd., a cyber-security consultancy based out of the U.K. It’s estimated that by the end of the decade, cyber-security businesses should be worth about $23 billion.

Then there’s the potential for royalties associated with its patents. While spending 65% of its R&D on hardware is silly going forward, it has provided BlackBerry with a war chest of patents that, if it were to start demanding payment, could generate significant earnings. One analysts believes that these patents could be worth US$400 million in profits for BlackBerry.

Right now, I don’t know where the company is going to wind up. I’m avoiding this stock until the company announces that it will be getting rid of its hardware division. The writing on the wall couldn’t be clearer: people don’t want BlackBerry phones, but they do want BlackBerry software. The company needs to make the right decision and sell its hardware; if it does, this will be a buy for me.

Urgent update: Motley Fool issues rare "double down" stock alert

Not to alarm you but you recently missed an important and rare event. Stock Advisor Canada issued a "double down"... and history suggests it pays to listen. Because 10 of the most lucrative "double downs" in one of the Motley Fool's premier services skyrocketed an average of 434%! So, simply click here to discover why Motley Fool "double downs" have some investors rocking with excitement. Five years from now, you'll wish you'd grabbed this stock. Click here to learn more.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Jacob Donnelly has no position in any stocks mentioned. The Motley Fool owns shares of Verizon Communications. Verizon Communications is a recommendation of Stock Advisor Canada.