This undated publicity photo released by the Sundance Institute shows Ashton Kutcher as Steve Jobs in the film, jOBS, directed by Joshua Michael Stern.

San Francisco - It was the late Steve Jobs' worst nightmare.

A powerful Asian manufacturer, Samsung Electronics uses Google's Android software to create smartphones and tablets that closely resemble the iPhone and the iPad. Samsung starts gaining market share, hurting Apple's margins and stock price and threatening its reign as the king of cool in consumer electronics.

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 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, 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 on capital expenditures in 2012 alone, and plans to spend a similar amount this year.

By comparison, Intel spent around $11-billion in 2012, and Taiwan Semiconductor Manufacturing (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 US 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.

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. - Reuters