UNTIL a few years ago HTC was pretty small and relatively obscure. But the Taiwanese company's recent growth has been remarkable. In the second quarter it sold 11m smartphones, more than doubling its revenues compared with a year earlier. HTC's main rivals, Nokia, Samsung and Apple, still sell around twice as many smartphones. But HTC's rapid growth, especially in Apple's American home turf, has made it a competitor worth worrying about.

One reason for HTC's surging sales is the relentless pace of its innovation: in the past quarter, in which Apple had no new iPhone to launch, HTC introduced ten new models. Another is Google's Android operating system, on which most of HTC's smartphones are now based. Android phones have proved a hit among consumers, and their combined sales overtook those of iPhones last summer.

Apple has not taken the challenge from HTC lightly. On July 15th the US International Trade Commission made a preliminary ruling upholding two claims in a far larger patent suit Apple had filed against its rival. Earlier in the month, Apple had filed additional claims and MOSAID, a Canadian company, said it would sue HTC and Sony Ericsson for allegedly infringing its patent for transmitting a mobile handset's location when its user makes an emergency call.

The outcome of these cases will be of keen interest not just for HTC but for all other handset-makers using Android: promoted as a free, open-source system, it is proving increasingly expensive. This is because it relies on a whole host of basic features that are, or may be, subject to patent: how a screen is swiped with a finger, how a phone number embedded in an e-mail can be called by tapping it, and so on.

Apple, having recently settled a patent case brought against it by Nokia, is suing Samsung and Motorola as well as HTC. Last year HTC resolved another claim over Android, with Microsoft, agreeing to pay it significant royalties. More such suits may yet emerge (from Nokia for example), and prove costly. HTC's shares, which had surged in reaction to the strong growth of its smartphone sales, have dropped by a third since early June.

HTC will appeal against the trade commission's ruling. It will also fight back in other ways. Earlier this month it bought a lossmaking software firm, S3, for $300m. S3 recently won a patent case against Apple and may have other patents, which might be used to launch a counter-suit against Apple, or at least persuade it to agree a truce. On Wednesday the Wall Street Journal reported (paywall) that Google itself was considering a similar move: buy a smaller firm with a collection of patents to boost its armoury in the patent war. Pierre Ferragu, an analyst with BernsteinResearch, believes the takeover of S3 will provide HTC with some winning cards in its legal poker game. It also shows, says Mr Ferragu, that the next phase of mobile-phone development will be driven at least as much by the courts as by consumers.

A shaky start
HTC has been sucked into this American legal battle as a result of it following a course that most of its Asian peers have not pursued, at least not successfully. Founded in 1997 out of the embers of the Taiwanese operations of Digital Equipment, HTC initially took the conventional approach of building gadgets for others to sell. It tried to launch a laptop but the product never came to market. Then an introduction from Microsoft led to its design of an early PDA for Compaq. It subsequently built similar products for Palm and others.

In 2001, just as many of the Taiwanese manufacturers were shifting operations to China, it bucked the trend again and built a factory next to its headquarters. Most of its production capacity remains in Taiwan. In the past five years or so it has steadily risen up mobile operators' lists of the handsets they promote to their subscribers. In April HTC's market capitalisation overtook that of Nokia.

The firm's success has pushed Cher Wang, its chairwoman and largest shareholder, to the top of Forbes's Taiwan rich list, passing Terry Gou, the boss of Hon Hai, a company (also known as Foxconn) that reflects a radically different, and more traditional, model of Taiwanese business. Hon Hai has moved most of its production to mainland China and continues to make products for other companies, a business that inevitably emphasises cost-trimming and low value-added.

HTC has distinguished itself through its speed in building new products—first, ones that ran on Microsoft operating software, now Android ones. It has also been impressively quick in adapting to changing telecoms standards—most recently 4G—and in developing its own applications software. And its manufacturing quality has been remarkably high. Unlike rivals HTC has not suffered unpleasant headlines about shoddy products or suicides at its factories.

The company has continued to produce a string of subtle but clever features: phones that ring louder when placed in a handbag; ones that stop ringing when flipped over in a meeting; ones designed to work smoothly with Facebook and other social-networking sites, and so on. It has made progress in building a brand that reflects innovation and trust, allowing it to escape from the low-cost treadmill on which some of its peers remain stuck.

But there is a risk that Android, one of the key elements in this successful strategy, is turning into a point of vulnerability. HTC's most fearsome competitor, Apple, sees its patents as a weapon to undermine Android's cost advantage. Others are seeking their pound of flesh too. The more time HTC has to spend fighting lawsuits, and the greater the share of its revenues it has to pay out in software royalties, the harder it will be to keep up its remarkable run of innovation and sales success. If that proves to be the case, what can HTC do? Switch to using Microsoft's operating software for most of its smartphones, maybe?