SAN FRANCISCO/SEOUL (Reuters) - It was the late Steve Jobs’ worst nightmare. A powerful Asian manufacturer, Samsung Electronics Co Ltd, uses Google Inc’s Android software to create smartphones and tablets that closely resemble the iPhone and the iPad. Samsung starts gaining market share, hurting Apple Inc’s margins and stock price and threatening its reign as the king of cool in consumer electronics.

An employee holds Apple's iPhone 4s (L) and Samsung's Galaxy S III at a store in Seoul in this file photo from August 24, 2012. REUTERS/Lee Jae-Won/Files

Jobs, of course, had an answer to all this: a “thermo-nuclear” legal war that would keep clones off the market. Yet nearly two years after Apple first filed a patent-infringement lawsuit against Samsung, and six months after it won a huge legal victory over its South Korean rival, Apple’s chances of blocking the sale of Samsung products are growing dimmer by the day.

Indeed, a series of recent court rulings suggests that the smartphone patent wars are now grinding toward a stalemate, with Apple unable to show that its sales have been seriously damaged when rivals, notably Samsung, imitated its products.

That, in turn, may usher in a new phase in the complex relationship between the two dominant companies in the growing mobile computing business.

Tim Cook, Jobs’ successor as Apple chief executive, was opposed to suing Samsung in the first place, according to people with knowledge of the matter, largely because of that company’s critical role as a supplier of components for the iPhone and the iPad. Apple bought some $8 billion worth of parts from Samsung last year, analysts estimate.

Samsung, meanwhile, has benefited immensely from the market insight it gained from the Apple relationship, and from producing smartphones and tablets that closely resemble Apple’s.

While the two companies compete fiercely in the high-end smartphone business - where together they control half the sales and virtually all of the profits - their strengths and weaknesses are in many ways complementary. Apple’s operations chief, Jeff Williams, told Reuters last month that Samsung was an important partner and they had a strong relationship on the supply side, but declined to elaborate.

As their legal war winds down, it is increasingly clear that Apple and Samsung have plenty of common interests as they work to beat back other potential challengers, such as BlackBerry or Microsoft.

The contrast with other historic tech industry rivalries is stark. When Apple accused Microsoft in the 1980s of ripping off the Macintosh to create the Windows operating system, Apple’s very existence was at stake. Apple lost, the Mac became a niche product, and the company came close to extinction before Jobs returned to Apple in late 1996 and saved it with the iPod and the iPhone. Jobs died in October 2011.

Similarly, the Internet browser wars of the late 1990s that pitted Microsoft against Netscape ended with Netscape being sold for scrap and its flagship product abandoned.

Apple and Samsung, on the other hand, are not engaged in a corporate death match so much as a multi-layered rivalry that is by turns both friendly and hard-edged. For competitors like Nokia, BlackBerry, Sony, HTC and even Google - whose Motorola unit is expected to launch new smartphones later this year - they are a formidable duo.

THE WAY THEY WERE

The partnership piece of the Apple-Samsung relationship dates to 2005, when the Cupertino, California-based giant was looking for a stable supplier of flash memory. Apple had decided to jettison the hard disc drive in creating the iPod shuffle, iPod nano and then-upcoming iPhone, and it needed huge volumes of flash memory chips to provide storage for the devices.

The memory market in 2005 was extremely unstable, and Apple wanted to lock in a supplier that was rock-solid financially, people familiar with the relationship said. Samsung held about 50 percent of the NAND flash memory market at that time.

“Whoever controls flash is going to control this space in consumer electronics,” Jobs said at the time, according to a source familiar with the discussions.

The success of that deal led to Samsung supplying the crucial application processors for the iPhone and iPad. Initially, the two companies jointly developed the processors based on a design from ARM Holdings Plc, but Apple gradually took full control over development of the chip. Now Samsung merely builds the components at a Texas factory.

The companies built a close relationship that extended to the very top: in 2005, Jay Y. Lee, whose grandfather founded the Samsung Group, visited Jobs’ home in Palo Alto, California, after the two signed the flash memory deal.

The partnership gave Apple and Samsung insight into each other’s strategies and operations. In particular, Samsung’s position as the sole supplier of iPhone processors gave it valuable data on just how big Apple thought the smartphone market was going to be.

“Having a relationship with Apple as a supplier, I am sure, helped the whole group see where the puck was going,” said Horace Dediu, a former analyst at Nokia who now works as a consultant and runs an influential blog. “It’s a very important advantage in this business if you know where to commit capital.”

Samsung declined to comment on its relationship with a specific customer.

As for Apple, it reaped the benefit of Samsung’s heavy investments in research and development, tooling equipment and production facilities. Samsung spent $21 billion (23 trillion won) on capital expenditures in 2012 alone, and plans to spend a similar amount this year.

By comparison, Intel Corp spent around $11 billion in 2012, and Taiwan Semiconductor Manufacturing Co Ltd (TSMC) expects to spend $9 billion in 2013.

But component expertise, cash and good market intelligence did not assure success when Samsung launched its own foray into the smartphone market. The Omnia, a Windows-based product introduced in 2009, was so reviled that some customers hammered it to bits in public displays of dissatisfaction.

Meanwhile, Samsung publicly dismissed the iPhone’s success.

“The popularity of iPhone is a mere result of excitement caused by some (Apple) fanatics,” Samsung’s then-president, G.S. Choi, told reporters in January 2010.

Privately, though, Samsung had other plans.

“The iPhone’s emergence means the time we have to change our methods has arrived,” Samsung mobile business head J.K. Shin told his staff in early 2010, according to an internal email filed in U.S. court.

Later that year, Samsung launched the Galaxy S, which sported the Android operating system and a look and feel very similar to the iPhone.

STANDOFF

Jobs and Cook complained to top Samsung executives when they were visiting Cupertino. Apple expected, incorrectly, that Samsung would modify its design in response to the concerns, people familiar with the situation said.

Apple’s worst fears were confirmed with the early 2011 release of the Galaxy Tab, which Jobs and others regarded as a clear rip-off of the iPad.

Cook, worried about the critical supplier relationship, was opposed to suing Samsung. But Jobs had run out of patience, suspecting that Samsung was counting on the supplier relationship to shield it from retribution.

Apple filed suit in April 2011, and the conflagration soon spread to courts in Europe, Asia and Australia. When Apple won its blockbuster billion-dollar jury verdict against Samsung last August, it appeared that it might be able to achieve an outright ban on the offending products - which would have dramatically altered the smartphone competition.

But Apple has failed to convince U.S. judges to uphold those crucial sales bans - in large part because the extraordinary profitability and market power of the iPhone made it all but impossible for Apple to show it was suffering irreparable harm.

“Samsung may have cut into Apple’s customer base somewhat, but there is no suggestion that Samsung will wipe out Apple’s customer base, or force Apple out of the business of making smartphones,” U.S. District Judge Lucy Koh wrote. “The present case involves lost sales - not a lost ability to be a viable market participant.”

Samsung, meanwhile, came under pressure from antitrust regulators and pulled back on its effort to shut down Apple sales in Europe over a related patent dispute.

A U.S. appeals court recently rejected Apple’s bid to fast-track its case, meaning its hopes for a sales ban are now stuck in months-long appeals, during which time Samsung may very well release the next version of its hot-selling Galaxy phone.

THE WORLD IS OURS

The legal battles have been less poisonous to the relationship than some of the rhetoric suggests.

“People play this stuff up because it shows a kind of drama, but the business reality is that the temperature isn’t that high,” said one attorney who has observed executives from both companies.

Still, the hostilities appear to have put some dents in the partnership. Apple is likely to switch to TSMC for the building of application processors, according to analysts at Goldman Sachs, Sanford Bernstein and other firms. But analysts at Korea Investment & Securities and HMC Securities point out that Apple will not be able to eliminate Samsung as a flash supplier because it remains the dominant producer of the crucial chips.

Apple declined to comment on the details of its relationships with any one supplier.

Meanwhile, both companies are deploying strategies out of the other’s playbook as they seek to maintain and extend their lead over the pack.

Samsung has developed a cheeky, memorable TV ad that mocks Apple customers, and dramatically ramped up spending on marketing and advertising, a cornerstone of Apple’s success. U.S. ad spending on the Galaxy alone leaped to nearly $202 million in the first nine months of 2012, from $66.6 million in 2011, according to Kantar Media.

For its part, Apple is investing in manufacturing by helping its suppliers procure the machinery needed to build large-scale plants devoted exclusively to the company.

Apple spent about $10 billion in fiscal 2012 on capital expenditures, and it expects to spend a further $10 billion this year. By contrast, the company spent only $4.6 billion in fiscal 2011 and $2.6 billion in fiscal 2010.

But Apple and Samsung retain very different strategies. Apple has just one smartphone and only four product lines in total, and tries to keep variations to a bare minimum while focusing on the high end of the market.

Samsung, by contrast, has 37 phone products that are tweaked for regional tastes and run the gamut from very cheap to very expensive, according to Mirae Asset Securities. The company also makes chips, TVs, appliances and a host of other products (and its brethren in the Samsung Group sell everything from ships to insurance policies).

Apple devices are hugely popular in the United States; Samsung enjoys supremacy in developing countries like India and China. Apple keeps its core staff lean - it has only 60,000 employees worldwide - and relies on partners for manufacturing and other functions. Samsung Electronics, part of a sprawling “chaebol,” or conglomerate, that includes some 80 companies employing 369,000 people worldwide, is far more vertically integrated.

It is those differences, combined with the formidable strengths that both companies bring to the market, that may render quiet cooperation a better strategy than all-out war for some time to come.

Said Brad Silverberg, a former Microsoft executive who was involved in the Mac vs. Windows wars, “Apple had learnt a lot of lessons from those days.”