“TEN to 15 years from now, I think China can be eBay’s largest market on a global basis.” So declared Meg Whitman grandly back in 2004. At the time, she was the chief executive of eBay, an American e-commerce pioneer. Things did not work out as planned. Local competition proved so fierce and nimble, in contrast to eBay’s managers, that the company was forced to beat a humiliating retreat.

The local leading the charge was Jack Ma, a school teacher who founded Alibaba at his apartment in Hangzhou, a city near Shanghai, in 1999. The original Alibaba website connected small manufacturers at home with commercial buyers overseas. But Mr Ma sensed early on that the real prize would be serving China’s rising middle classes. So he formed Taobao, a portal that consumers use to sell to each other, and added Tmall, a business-to-consumer (B2C) site.

Alibaba’s triumph has been breathtaking. The firm’s portals control four-fifths of all e-commerce in China. Taobao is the country’s leading e-commerce website, and Tmall leads the B2C market. The firm’s sales exceeded $5.7 billion last year on Singles’ Day, a marketing event held annually on November 11th. Measured by the value of goods sold on its platforms, Alibaba is bigger than eBay and Amazon combined.

Mr Ma may soon best Silicon Valley rivals in another way: Alibaba could become the largest-ever initial public offering (IPO) in America. After many months of speculation, on May 6th Alibaba unveiled its prospectus to list in New York.

Pundits have been breathlessly predicting that this flotation could raise $15 billion-20 billion, making it one of the biggest ever. Polls of analysts suggest that the resultant valuation of the firm could exceed $150 billion (see chart). In its filing, Alibaba revealed its valuation of itself, based on what it thinks existing shares (held by insiders and early investors) are worth: roughly $110 billion.

But boosters arguing for much higher valuations are sure to pick up on other figures included in the filing. For example, punters spent nearly $250 billion on the firm’s e-commerce sites last year. Alibaba’s revenues surged by over half and its profit margin exceeded 40% during the last nine months of 2013. That confirms rosy figures suggested earlier in regulatory filings by Yahoo, an American firm that holds roughly 23% of Alibaba (and is required by contract to sell much of its stake in the IPO).

Tricky timing

Still, the short-term outlook is dicey. The value of technology stocks listed in America has fallen by perhaps $150 billion since a peak in early March. Chinese stocks are out of favour, too. WH Group, a Chinese pork giant that last year acquired America’s Smithfield Foods, another pork company, cancelled its proposed $1.9 billion IPO in Hong Kong last month. And Sina Corp, which controls Weibo, a popular Chinese microblog, was forced to cut the size of Weibo’s IPO in New York last month.

The dark mood explains why Alibaba has decided to offer merely a token amount at first—the prospectus says $1 billion—to test the waters. This will be raised in coming months as demand allows. The firm’s bosses remember all too well that the over-hyped IPO of Facebook two years ago initially flopped.

But Facebook later rebounded: its shares are up by half since flotation, despite the recent tech rout, and its market value stands at roughly $150 billion. That example suggests that the right way to judge Alibaba’s future is to look beyond the inevitable ructions of the coming weeks to its longer-term prospects.

As is typical of IPO filings, Alibaba’s prospectus outlines lots of risks. Regulatory uncertainty is one worry. For example, Chinese officials could interfere with AliPay, an online-payments system started by the firm that is vital to its success not only in e-commerce but also in internet finance and other areas of expansion.

AliPay is currently not part of the group being floated in New York. It is held by a sister financial firm controlled by Mr Ma and a handful of associates, having been spun out of Alibaba in 2010 without Yahoo’s consent. Mr Ma now plans to reduce his holding in AliPay from 46% to roughly 8%. This would allow the listed firm to reclaim a big stake in AliPay—if regulators permit a foreign entity (which Alibaba’s Cayman-registered vehicle would be) to invest in the payment system, something they have not been keen on in the past. Mr Ma vows not to enrich himself in the process; many of his shares are to be given to managers and employees.

The Cayman Islands vehicle poses another risk: the prospectus warns that “your ability to protect your rights through the US Federal courts may be limited”. Yet another worry for ordinary shareholders (one that led the Hong Kong stock exchange to reject Alibaba’s IPO) is that a handful of insiders led by Mr Ma will have the power to control the board in perpetuity without owning a majority of the shares.

These sorts of risk look manageable. The bigger worry is that the age of easy profits is over. Alibaba’s dominance of Chinese e-commerce is an artefact of the era of the personal computer (PC). But faster than in any other big market, China is moving to mobile commerce. It is already the world’s largest market for smartphones. The firm says “an increasing percentage of our users are accessing our marketplaces through mobile devices, a trend that we expect to continue.”

Game of thrones

The snag? M-commerce is a wild new frontier in which Alibaba is but one player among many. It acknowledges this: “we face a number of challenges to successfully monetising our mobile user traffic.” For the first time, the Goliath is worried about disruptive rival entrepreneurs. At the same time it must continue to fight the war of the “three kingdoms” against two other giants of the local internet: Baidu and Tencent.

In the past, they were content to milk their quasi-monopolies: Baidu dominated PC-based search, Tencent made a mint on online games and Alibaba got fat on e-commerce. But the rise of the mobile internet has ended the truce. The heavyweights are now in a frenzied and costly contest to acquire innovative startups. They have recently spent billions of dollars to buy social-networking firms, group-buying apps, online-video portals and so on.

Baidu had grown complacent after Google’s exit from China, and was slow to embrace mobile search. But it has roused itself, acquiring lots of startups and developing in-house innovations (ranging from cutting-edge voice recognition and translation to maps and location-based services). Baidu wants to challenge Alibaba’s efforts in the burgeoning area of “online-to-offline” services, such as taxi-hailing apps.

An even bigger threat to Alibaba is Tencent. The firm recently invested in JD, China’s second-largest e-commerce firm (whose IPO in New York is already under way). So successful is WeChat, its social-messaging app, at integrating social networking, payments, e-commerce and entertainment that it has been valued by some analysts at more than $60 billion, three times what Facebook paid for WhatsApp, another messaging service.

A bet on Alibaba is really a bet that three interlinked trends will compensate for these risks. The first is the spectacular rise of China’s economy, which is forecast to surpass America’s in size shortly, in purchasing-power terms. Since Alibaba reaches into every corner of the country, it should profit from that growth. Second, the ongoing shift from investment- to consumption-led growth means that firms that make it easy to sell directly to consumers should benefit disproportionately.

Finally, buying Alibaba’s shares is also a bet on a continued surge in what is already the world’s largest e-commerce market. Internet penetration is still lower than in developed countries; China will surely catch up. One informed estimate holds that China’s e-commerce market could double by 2020, to over $600 billion.

The path ahead for Alibaba will not be as easy as the road that brought it to the world’s attention this week, but the competition to come should make the firm fitter. If it answers the challenges with agility and innovation—and recent evidence suggests it is spoiling for this fight—it will do more than merely defend its turf as China’s e-commerce king. Alibaba will then deserve to be one of the most valuable companies in the world.