BlackBerry, the Canadian company that invented the smartphone and addicted legions of road warriors to the “crackberry,” has stopped making its iconic handsets.

Finally conceding defeat in a battle it had long ago lost to Apple and Samsung Electronics, BlackBerry is handing over production of the phones to overseas partners while it turns its full attention to the more profitable and growing software business.

BlackBerry said Wednesday it struck a licensing agreement with an Indonesian company to make and distribute BlackBerry-branded devices. More deals are in the works with Chinese and Indian manufacturers. It’s the formalization of a move long in the making, ever since CEO John Chen took over nearly three years ago and outsourced some manufacturing to Foxconn Technology Group.

BlackBerry, based in Waterloo, Ontario, gained as much as 4.3 percent to C$10.86 as the market opened in Toronto. It was the biggest intraday jump since July. Getting the money-losing smartphone business off BlackBerry’s books will make it easier for the company to consistently hit profitability. It will still design smartphone applications and an extra-secure version of Alphabet Inc.’s Android operating system.

“We are reaching an inflection point with our strategy,” Chen said in a statement announcing the shift as well as quarterly earnings. “Our financial foundation is strong, and our pivot to software is taking hold.”

The new strategy will improve margins and could actually increase the number of BlackBerry-branded phones sold, Chen said, as manufacturers license the name that still holds considerable sway in emerging markets like Indonesia, South Africa and Nigeria.

Although BlackBerry’s latest phone, the DTEK50, was already almost completely outsourced, the move is a big symbolic step for a company that once reached a market value of $80 billion.

When the BlackBerry 850 was released in 1999, it married a functional keyboard with email capability and essentially ushered in the modern smartphone era. With a proprietary operating system known for its watertight security, it was an instant hit with business executives and even heads of state, including President Obama. The phones were ubiquitous and extended the workday onto commuter trains and into restaurants and homes.

Then, in 2007, enter the iPhone with its touchscreen interface and app store. People at first said they didn’t want to give up BlackBerry’s keyboard and simplicity. But the lure of apps eventually sent almost all its users to phones running Android or iOS.

“It was inevitable at this point; they didn’t have the unit volumes to sustain the business profitably,” said Matthew Kanterman, an analyst with Bloomberg Intelligence. “This is doubling down on the efforts to focus on software which is really what their strength is.” BlackBerry shipped only 400,000 phones in its fiscal second quarter, half what it sold in the same period last year. Apple sold more than 40 million iPhones last quarter.

BlackBerry said software and services revenue more than doubled in the quarter from a year earlier to $156 million. Still, software revenue was down from the previous quarter’s $266 million, which Chen blamed on patent licensing deals that didn’t carry over into the quarter.

Adjusted earnings were at break-even, compared with analysts’ estimates for a loss of 5 cents.