Two years after sealing its fate to Microsoft's Windows Phone software, Nokia has collapsed into the arms of the US software giant, agreeing to sell its main handset business for €5.44 billion.
Nokia will continue as a maker of networking equipment and holder of patents.
The company was once the world's dominant handset manufacturer but was long since overtaken by Apple and Samsung in the highly competitive market for more powerful smartphones.
Nokia's Canadian boss Stephen Elop, who ran Microsoft's business software division before joining to Nokia in 2010, will now return to the US firm as head of its mobile devices business.
He is being discussed as a possible replacement for Microsoft's retiring chief executive Steve Ballmer, who is trying to remake the US firm into a gadget and services company like Apple before he departs, after disastrous attempts so far to compete in mobile devices.
In three years under Elop, Nokia saw its market share collapse and its share price shrivel as investors bet heavily that his strategy would fail.
Shares in Nokia surged 34% in Helsinki yesterday as investors who had borrowed and sold the stock to bet on further price falls rushed to buy back to limit their losses. They are still only a fraction of their 2000 peak of €65.
After today's gains the whole company is worth about €15 billion, a far cry from its glory days, when it peaked at over €200 billion.
But shares in Microsoft fell by 4.5% on Wall Street today.
In 2011, after writing a memo that said Nokia was falling behind and lacked the in-house technology to catch up, Elop made the controversial decision to use his former firm Microsoft's Windows Phone for smartphones, rather than Nokia's own software or Google's Android operating system.
Nokia, which had a 40% share of the handset market in 2007, now has a mere 15% market share, with an even smaller 3% share in smartphones.
The sale of the handset business is not the first dramatic turn in the 148-year history of a company which has sold everything from television sets to rubber boots. But it was felt as a hard blow in its native Finland, even among hard-nosed investors who saw the sale as a final chance to salvage value.
Alexander Stubb, Finland's minister for European Affairs and Foreign Trade, said on his Twitter account: "For a lot of us Finns, including myself, Nokia phones are part of what we grew up with. Many first reactions to the deal will be emotional."
Find out about the changing fortunes of Nokia.
The deal is also a pivotal moment for Microsoft, which still has huge revenues from its Windows computer operating system, Office suite of business software and the X-Box game console, but never managed to set up a profitable mobile device business.
Microsoft's own mobile gadget, the Surface tablet, has sold tepidly since it was launched last year.
"It's a bold step into the future - a win-win for employees, shareholders and consumers of both companies," Ballmer said in a statement. "Bringing these great teams together will accelerate Microsoft's share and profits in phones and strengthen the overall opportunities for both Microsoft and our partners across our entire family of devices and services."
The move leaves the Finnish company with Nokia Solutions and Networks, which competes with the likes of Ericson and Huawei in telecoms equipment, as well as a navigation business and a broad portfolio of patents, which will be licensed to Microsoft.
The Nokia deal thrusts Microsoft deeper into the hotly contested mobile phone market, despite some investors urging it stick to its core strengths of business software and services.
Elop will return as Microsoft's board ponders a successor to Ballmer, who will depart sometime in the next 12 months. He will head an expanded Devices unit at the US company.
Nokia is still the world's second biggest mobile phone maker behind Samsung, but it is not in the top five in the more lucrative and faster-growing smartphone market.
Sales of Nokia's Lumia series have helped the market share of Windows Phones in the global smartphone market climb to 3.3%, according to consultancy Gartner, overtaking ailing BlackBerry Ltd for the first time this year. Still, Google's Android and Apple's iOS system make up 90% of the market.
Nokia said in a statement it expected that, apart from Elop, senior executives Jo Harlow, Juha Putkiranta, Timo Toikkanen, and Chris Weber would transfer to Microsoft when the deal is concluded. It did not say what roles they would take there.
Nokia board chairman Risto Siilasmaa would take over CEO duties while the Finnish firm looked for a new CEO, it said.
The deal is expected to close in the first quarter of 2014, subject to approval by Nokia shareholders and regulators.