Facebook CEO Mark Zuckerberg. Getty

To understand why Mark Zuckerberg is obsessed with killing the smartphone, you have to go back to a rare public testimony he gave in a Dallas courtroom earlier this year.

Zuckerberg was there to testify in a lawsuit between game maker ZeniMax and Oculus, the virtual reality startup Facebook purchased for $2 billion in 2014.

While he was on the stand, Zuckerberg was asked to elaborate on the implications of Facebook missing out on the smartphone revolution. Zuckerberg had started Facebook in 2004, just after mobile phones were already starting to catch on.

"Because of that, Facebook hasn't really been involved in designing the operating systems and phones," he explained. "Companies like Google and Apple have done that instead. And that in some cases meant we haven't been able to design the experiences that we hoped to deliver for our community."

Here's what Zuckerberg was getting at: the world of mobile phones that Facebook has built its $415 billion ad business on is owned and controlled by Apple and Google, not Facebook. Apple and Google are the landlords, and Facebook is just a tenant.

The promise of augmented reality

Zuckerberg has said it will take years before there are stylish AR glasses "we all want." Getty

It's with that context behind it that Facebook is now betting its future on augmented reality, the nascent technology that promises to overlay virtual information onto the real world and eventually replace smartphones with something like a pair of glasses or even contact lenses.

At Facebook's annual developer conference this past week, Zuckerberg unveiled a platform for the Facebook app's camera that can let outside developers create AR effects, like a video game character over a person's face or virtual dolphins swimming around a bowl of cereal.

The end goal of AR, Zuckerberg said, is to have a pair of stylish glasses that can display everything from directions and entertainment to information about the objects you're looking at, like the cost of a bottle of wine, directly in front of your eyes. And he wants all of it to be powered by Facebook.

"We see the beginning of a new platform," he said.

Owning what comes after the phone

Magic Leap has raised more than $1 billion to build what it claims will be the world's first consumer AR headset. Magic Leap

It's easy and obvious to say that Facebook's push into AR and cameras now is a reaction to Snapchat, the rival social networking service with its signature filters and AR effects. And that is probably true.

But the much larger motivation behind Facebook's investments in virtual and augmented reality is simple: to not miss out on the next big wave of technology that comes after smartphones. That's why Facebook paid billions for Oculus, is working on its own AR hardware and brain-controlled sensors, and is opening up its AR camera effects to developers now.

If Facebook can build the AR equivalent of Apple's iOS operating system for iPhones, it has a shot at controlling the platform on which every other company will have to build AR hardware.

Imagine a future post-phone world in which, instead of Apple or Google, Facebook set the ground rules about what apps can and can't do on its platform. Like Apple's App Store, Facebook could take a cut of all transactions that occur within its AR platform. And Facebook would know more about its billions of users — what they're seeing and interacting with in the real world — than any company in history.

"If we can build it"

Facebook sells the expensive Oculus Rift VR headset, and it's looking at making AR hardware too. AP Photo/Eric Risberg

Facebook would certainly like to own both the dominant hardware and the software in a truly AR world, but if it can't crack the hardware, it wants to at least be one of the few winning software providers.

"If we can build an interesting business building hardware, that’s great," Facebook chief technology officer Mike Schroepfer recently told Business Insider about the company's AR ambitions. "But if that doesn’t work and it just creates an ecosystem and we have an awesome network to run on top of it, that’s great too."

But as Apple, Microsoft, Magic Leap, and others are racing to make consumer AR a reality, the competition is already fierce. And with its hundreds of billions of dollars and years of hardware expertise, Apple already looks best poised to win the AR hardware race.

That's why Facebook is firing on all of its AR cylinders now, even when it says that consumer adoption of AR is potentially decades away. The existential threat to Facebook's business is that if it doesn't manage to build the dominant AR platform of the future, it runs the risk of repeating its history with mobile phones all over again.