A jury sided with Google in an $8.8 billion copyright case brought by Oracle.
The jury found that Google's use of Oracle's APIs in its Android operating system was fair use. It reached the verdict after three days of deliberation in San Francisco court.
Oracle says it plans to appeal the decision.
This was the $9 billion question: If a software company puts a free tool online, do developers need the company's permission to use it?
The case focused on 37 application programming interfaces that Google included in its Android operating system in 2009. APIs help different kinds of software communicate with one another.
The APIs that Google used were for Java, a ubiquitous computer programming language that belonged to Sun Microsystems at the time. Oracle bought Sun in 2010 and sued Google later that year. The two Silicon Valley titans have been duking it out in various courts ever since.
Even with Thursday's verdict, the battle won't end any time soon.
"We strongly believe that Google developed Android by illegally copying core Java technology to rush into the mobile device market," said Oracle general counsel Dorian Daley in a statement. "We believe there are numerous grounds for appeal."
The Java APIs were open-source, free to use for anyone. Google did try to arrive at a deal with Sun to use the APIs, but those deals fell apart and Google decided to use the APIs anyway. Oracle (ORCL) claimed that Google violated its copyrights and patents by using the APIs in Android.
The case took some seriously strange twists and turns: A jury in 2012 ruled in Oracle's favor. But District Judge William Alsup overruled the jury's decision, giving a directed verdict that determined APIs could not be copyrighted. An appeals court overturned the judge's ruling in 2014. Google appealed it to the Supreme Court, which declined to take up the case, leaving the appeals court ruling intact.
However, the ruling did not address Google's claims that putting the Java APIs in Android constituted fair use. That's a legal precedent that, in certain circumstances, can allow companies to use copyrighted content without the owner's permission.
So the case went back to the district court for a jury to rule on the fair use issue.
Related: Google's Android secrets revealed in court
Google (GOOGL) argued that it transformed Java into something completely new and useful for its customers, so its actions should be protected under the fair use principle.
Oracle, on the other hand, claimed that Google stole its property, using it to enrich itself to the tune of tens of billions of dollars. In court, Oracle claimed that Android has produced $31 billion in sales and $22 billion in profit since 2008, a number that Google disputes.
As a result, Oracle is sought $9 billion in damages from Google.
Oracle claims that Java could have become the software of choice for smartphones had Google not used the APIs in Android. Oracle also argued that Google owes it licensing fees.
Judge Alsup, who again oversaw the case, said that figure was "speculative," since we can't know whether Java would have taken a more prominent role in smartphones had Android not used the APIs.
The case could have resulted in the largest copyright verdict in U.S. history. The largest standing copyright verdict is $1.3 billion, awarded to Oracle when it sued rival SAP in 2010.
If Oracle won, companies would have had to decide whether to strike a deal with API makers ahead of time or go it alone and write their own APIs. It would have been an unwelcome choice between taking a hit to profit or interoperability.
"Today's verdict ... 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," said a Google spokesperson.
Heather Kelly contributed to this report.