Apple Inc. audio engineers had been working on an early version of the HomePod speaker for about two years in 2014 when they were blindsided by the Echo, a smart speaker from Amazon.com Inc. with a voice-activated assistant named Alexa. The Apple engineers jokingly accused one another of leaking details of their project to Amazon, then bought Echos so they could take them apart and see how they were put together. They quickly deemed the Echo’s sound quality inferior and got back to work building a better speaker.

More than two years passed. In that time Amazon’s Echo became a hit with consumers impressed by Alexa’s ability to answer questions, order pizzas and turn lights on and off. Meanwhile, Apple dithered over its own speaker, according to people familiar with the situation. The project was cancelled and revived several times, they said, and the device went through multiple permutations (at one point it stood 3 feet tall) as executives struggled to figure out how it would fit into the home and Apple’s ecosystem of products and services.

In the end, the company plowed ahead, figuring that creating a speaker would give customers another reason to stay loyal. Yet despite having all the ingredients for a serious competitor to the Echo—including Siri and the App Store—Apple never saw the HomePod as anything more than an accessory, like the AirPods earphones.

As a result, when the $350 gadget debuts early next year (on Friday Apple delayed the launch from December), the HomePod won’t be able to do many of the things the Echo can. Amazon offers thousands of “skills” (voice-activated apps) that let users do a range of things (including buy stuff from Amazon). The Google Home, which debuted earlier this year, is similarly endowed. The HomePod will be mostly limited to playing tunes from Apple Music, controlling Apple-optimized smart home appliances and sending messages through an iPhone.

“This is a huge missed opportunity,” said one of the people, who requested anonymity to discuss an internal matter. Apple declined to comment.

The HomePod was originally a side project cooked up about five years ago by a group of Mac audio engineers, who wanted to create a speaker that sounded better than the ones sold by the likes of Bose, JBL and Harman Kardon. Side projects aren’t uncommon at Apple, where employees are encouraged to follow their muse so long as their day jobs come first.

The engineers wanted a product that would past muster with audiophiles. Several members of the impromptu team hailed from big-name speaker makers and dreamed of perfecting a much-anticipated technology called “beam forming.” It directs sound to specific places in a room, creating immersive 3-D audio. (Sonos debuted a smart speaker with beam forming in October; the Google Home Max due out next month also has the technology. Amazon Echo’s microphones use beam forming to hear commands from anywhere in a room.)

Once Apple decided to use beam forming, designers experimented with various shapes. One prototype looked like a flat panel with a mesh screen on the front. Another was about five times as tall as today’s 7-inch HomePod and packed in dozens of speakers. At one point there was some discussion of selling the device under the Beats brand but the idea was abandoned. Designers also considered producing the speaker in several colors but eventually decided on black and white. Over the years a closet filled up with prototypes, a kind of mini museum dedicated to the HomePod.

Two years into development, the side project finally got an official codename (B238) and a home inside Apple’s accessories division, which also worked on the AirPods earphones and is run by Gary Geaves, who previously was R&D chief at audio company Bowers & Wilkens. When the HomePod project gained its own team, engineers were relocated to Valley Green 1, an office near Apple’s original headquarters in Cupertino, California. Apple tested many variations of the speaker in specially designed audio chambers and built a trio of testing spaces designed to mimic real life: a college dorm, living room and open-plan studio apartment. By 2016, Apple was testing the device inside the homes of employees not connected to the HomePod’s audio development in an effort to get unbiased feedback.

The HomePod’s six microphones were optimized to pick up commands over conversations, running washing machines and blasting televisions. The speaker grills were kid-proofed. The gadget’s feet were designed so the vibrations wouldn’t knock it off a shelf. Testers dropped the speaker from various heights and even threw it in a room with young kids.

While Apple engineers toiled away, Amazon unveiled the Echo. While it was officially called a speaker, the device’s main appeal was Alexa. By then, Apple’s own digital assistant, Siri, was three years old and had overcome initial glitches. But the Siri team was told that the HomePod was about music and quality sound, one of the people said. Yes, the speaker would be voice-activated but it wouldn’t be positioned as a personal assistant. As of this year, the HomePod was just one of the four or five areas the Siri team was working on, the person said.

The Echo is a truly standalone product at the center of an ecosystem. The cloud-based operating system has made it easy for developers to create thousands of skills or voice-activated apps. By contrast, the HomePod is essentially an extension of the iPhone, like an accessory. When someone asks the HomePod to open a third-party app, the request won’t go directly to the cloud, as with the Echo, but to an iPhone. As a result, developers can’t write apps for the HomePod. They must create tweaked versions of existing iPhone apps. What’s more, Apple has limited the kinds of apps to messaging, to-do lists and notes. If Alexa is the beating heart of the Echo, Siri is almost an afterthought.

On Apple’s website, the HomePod is listed as an accessory under the music menu. For several pages, the company touts the product’s superior sound quality, deemed excellent by reviewers. Eventually, the marketers get around to Siri. Even then, it’s still all about the music: “Hey Siri, who’s the drummer in this song? Hey Siri, play some hip hop.”

This isn’t the first time Apple has tried to sell its own speaker. In 2006, the company debuted the iPod Hi-Fi for $349. It flopped and was discontinued a year and a half after going on sale. Once again, Apple is betting superior audio will vault the HomePod past competing speakers. But rivals are following suit and improving the sound quality of their own products.

Sonos, a pioneer in quality wireless speakers, launched its first smart model last month, Google’s $400 Home Max will focus more on audio quality, and Amazon’s latest flagship Echo lineup has a more powerful speaker than the original.

Apple could still eventually add features to the HomePod. These might include its own app ecosystem and support for competing music services. Even so, until that happens, Apple will still be playing catchup in a category invented by a company better known for e-commerce than hardware.

Now read: Apple tops wearable device sales