REDMOND, Wash. — Microsoft Corp. is buying Nokia Corp.'s line-up of smartphones and a portfolio of patents and services.

It's an attempt to mount a more formidable challenge to Apple Inc. and Google Inc. as more technological tasks get done on mobile devices instead of personal computers.

The 5.44 billion euros ($7.2 billion) deal announced late Monday marks a major step in Microsoft's push to transform itself from a software maker focused on making operating systems and applications for desktop and laptop computers into a more versatile and nimble company that delivers services on any kind of Internet-connected gadget.

Microsoft, which is based in Redmond, Wash., is being forced to evolve because people are increasingly pursuing their digital lives on smartphones and tablet computers, causing the demand for PCs to shrivel. The shift is weakening Microsoft, which has dominated the PC software market for the past 30 years, and empowering Apple, the maker of the trend-setting iPhone and iPad, and Google, which gives away the world's most popular mobile operating system, Android.