Just a week and a half after announcing he would retire within a year, CEO Steve Ballmer is making a bold bet for Microsoft’s future: that his lumbering giant will be better off in the mobile business after buying the design smarts, engineering and technology of a fallen giant, Nokia.

Microsoft's agreement to buy Nokia’s handset business for about $7.2 billion, announced late Monday, is another step – and, in some ways, a relatively inexpensive one – in Microsoft’s shift to a “devices and services” company, a reorganization that outgoing CEO Ballmer detailed in a memo earlier this summer. Microsoft will be adding about 32,000 Nokia employees – expanding its workforce by nearly a third. As part of the deal, Nokia CEO Stephen Elop, a Microsoft veteran who was already considered a candidate to replace the retiring Ballmer, will return to head up Microsoft’s mobile device business.

Buying Nokia’s handset business will give Microsoft the ability to control both its Windows software design and the hardware it runs on, much as Apple has since the iPhone first came out and Google now can with its purchase of Motorola Mobility. At the very least, the deal should ensure that Microsoft’s Windows Phone software remains a player in the market, even if it does lag far behind Apple’s iOS and Google’s Android.

Whether the purchase can actually help Microsoft catch up with the mobile leaders is another question entirely. Thanks largely to a partnership with Nokia, Microsoft’s Windows Phone software has managed to surpass BlackBerry to become the third most popular mobile platform, but it holds about 3 percent of the U.S. smartphone market, according to comScore, lagging far behind Android, with 52 percent, and Apple, with about 40 percent. Microsoft’s Surface tablet has also failed to catch fire with consumers.

Microsoft under Ballmer has continued to generate huge revenues – more than $77 billion in fiscal year ended June 30, 2013 – but it has struggled to grow as consumers in particular shifted their purchases elsewhere. A Goldman Sachs analysis from last year reportedly pegged Microsoft’s overall share of operating systems across PCs and mobile devices at just 20 percent, behind Android’s 42 percent and Apple’s 24 percent. It will need to be more nimble and innovative if it is to change those trends.

Microsoft, of course, wasn’t the only giant to miss out on the smartphone revolution. Nokia blew it too. Once the dominant mobile handset maker, the deal marks the end of a steep decline for Nokia.

Go back and watch “The Matrix” and you’ll notice that Keanu Reeves’s Neo and his rebel cohorts use Nokia phones. It was smart product placement for the mobile leader at the time, reinforcing Nokia’s image as a maker of sleek, cool, futuristic products.

The movie came out in 1999. The next year, Nokia, with a history in the paper mill and rubber businesses dating back nearly 150 years, rode its booming mobile handset business to a peak market valuation around $250 billion. It was some 14 times as large as Apple.

Before very long, though, it became clear the future was moving in a different direction. The iPhone came out in 2007, and Nokia, known for its candybar-shaped feature phones, fell behind not only Apple but also Google’s Android operating system and, eventually, handset maker Samsung. Neo may not have used a smartphone, but the masses in the, ahem, real world were rushing to own them. Nokia controlled 40 percent of the handset market in 2007, but that share has fallen to 15 percent – and a measly 3 percent of the smartphone market.

At times, Nokia’s strategy for winning back market share seemed as confusing and feeble as the plots of “The Matrix” sequels. Nokia CEO Stephen Elop came over from Microsoft in 2010 and acknowledged as much in his “Burning Platform” memo to staff the following year, in which he bemoaned the company’s competitive position – losing to Apple at the high end of the smartphone market, overwhelmed by Android in the mid-range market and losing share to cheaper manufacturers at the low end.

“I have learned that we are standing on a burning platform. And, we have more than one explosion – we have multiple points of scorching heat that are fuelling a blazing fire around us,” Elop wrote.

“While competitors poured flames on our market share, what happened at Nokia? We fell behind, we missed big trends, and we lost time. At that time, we thought we were making the right decisions; but, with the benefit of hindsight, we now find ourselves years behind. The first iPhone shipped in 2007, and we still don’t have a product that is close to their experience. Android came on the scene just over 2 years ago, and this week they took our leadership position in smartphone volumes. Unbelievable.”

Elop, in a controversial move, decided to tie the handset maker’s fate to Microsoft, choosing to use Windows Phone software for its smartphones rather than Android or Nokia’s own Symbian operating system.

That decision ultimately set the stage for Monday’s deal – a deal that highlights just how badly both tech giants have stumbled. “It’s a bold step into the future — a win-win for employees, shareholders and consumers of both companies,” Ballmer said in announcing the purchase to Microsoft employees.

Only it’s nothing like the future Nokia could have envisioned back in 1999. And that’s precisely the problem.