Google's Android software has just dodged a £6 billion bullet.
A US jury found that Google did not need permission to use a rival's programming tools as it built Android - now the world's leading smartphone operating software and a key part of Google's multi-billion dollar Internet business.
Software competitor Oracle claimed Google had stolen its intellectual property and reaped huge profits by copying pieces of an Oracle programming language called Java.
But the jury in US District Court found that Google made "fair use", under copyright law, of Java elements that help different software programmes work together.
Oracle, which had sought 9 billion dollars (£6.1 billion) in damages, immediately said it would appeal.
The verdict was closely watched in Silicon Valley, in part because many popular features of today's smartphones only work because apps can "talk" to one another or the phone's underlying software.
Google's supporters - a group that included other tech firms, trade associations and the Electronic Frontier Foundation, an Internet rights group - warned that an Oracle victory would hamper future innovation by making software co-operation more difficult and expensive.
Google argued that because it used only a small part of Java to create Android, a much larger system of software built for a new purpose, it qualified for a "fair use" exemption from copyright.
Similar exemptions allow artists and critics to quote or reuse small portions of someone else's work in a larger essay or creation.
Oracle and its allies simply argued that the company should be paid for the use of its code.
While Google lets smartphone manufacturers use Android software without charge, it makes billions of dollars by showing advertising to people who use Google services, including its popular search engine and maps, on Android phones and tablets.
The high-profile dispute was a clash of Silicon Valley titans. While much of the trial focused on arcane aspects of computer programming, jurors heard testimony from prominent tech executives and two multi-billionaire moguls. Google co-founder Larry Page testified in person, while Oracle co-founder Larry Ellison appeared on video.
The jury's verdict marks Google's second victory in the case. US Judge William Alsup sided with Google in 2012, ruling that the APIs were not protected by copyright. An appellate court overturned the ruling and sent the case back for a second trial.
Oracle said it will appeal against the latest verdict on "numerous grounds".
Oracle general counsel Dorian Daley said: "We strongly believe that Google developed Android by illegally copying core Java technology to rush into the mobile device market."
Google welcomed the jury's finding.
"Today's verdict that Android makes fair use of Java APIs represents a win for the Android ecosystem, for the Java programming community, and for software developers who rely on open and free programming languages to build innovative consumer products," the company said.