SAN FRANCISCO — In one of the biggest technology deals of the past decade, Facebook agreed to buy WhatsApp for $16 billion to expand in the fast-growing mobile messaging market and pursue its goal of connecting as much of the world's population as possible over the Internet.

Facebook said it will pay $4 billion in cash and $12 billion in stock for WhatsApp, a service that has 450 million monthly users and is adding more than 1 million new users a day.

"WhatsApp is on a path to connect 1 billion people. The services that reach that milestone are all incredibly valuable," Facebook CEO Mark Zuckerberg said in a statement announcing the deal.

STORY: What is WhatsApp?

Zuckerberg has been trying to get into the mobile messaging market for a while. The company offered to buy Snapchat for $3 billion last year, but that messaging start-up spurned the offer.

To close the WhatsApp deal, Facebook offered an extra $3 billion in restricted stock units, a common type of equity compensation, to WhatsApp founders and employees. These awards will vest over four years. Jan Koum, WhatsApp's co-founder and CEO, also gets a seat on Facebook's board of directors.

While dwarfed by Time Warner's purchase of AOL at the height of the first dot-com boom, Facebook's $16 billion deal ranks as the fourth-largest technology acquisition of the past decade, according to Dealogic.

Zuckerberg paid so much for WhatsApp because the 5-year-old start-up is at the forefront of a new breed of mobile messaging apps that are becoming the main way smartphone users communicate with each other, especially in fast-growing developing markets like Africa, India and Southeast Asia.

Social networks like Facebook are currently the dominant way to keep in touch online, but that could change, and Zuckerberg does not want to be left behind.

"Facebook is trying to get involved in the new era of communication," said Ben Bajarin, principal industry analyst at tech research firm Creative Strategies. "It has shifted from social networking to these messaging services, which are becoming new platforms in and of themselves."

Zuckerberg has a broader goal of connecting most of the people on the globe through the Internet, and on Wednesday he said that WhatsApp fits well with this long-term effort.

The Facebook CEO said he contacted WhatsApp's Koum on Feb. 9 to suggest the two companies combine to pursue this vision. Koum thought about it for roughly a week and expressed interest. Then the two met to discuss the price of an acquisition and arrived at the deal that was announced Wednesday.

"For the next several yeas, we will focus on growing and connecting everyone in the world," Zuckerberg said during a conference call with Wall Street analysts. "Once we get to a service with 1 billion, 2, maybe 3 billion users one day ... then we can think about ways to monetize."

WhatsApp will stay an independent company. But as a part of Facebook, it will be able to focus purely on growth for longer, he added.

In the past, much of the spread of the Internet happened on desktop computers. But now the majority of new Internet users get connected through smartphones, which are expected to outnumber PCs soon.

Messaging services, like Line in Japan, WeChat in China and Kakao in South Korea, are the must-have apps for many of these new smartphone users.

"There was a time 12 to 18 months ago in emerging markets when one of the primary reasons to get a smartphone was to get on Facebook. That's not the case anymore," Bajarin said. "These messaging apps are the reason now. Everyone is asking their friends whether they are on these services."