Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A federal jury has sided with Google in a $9 billion legal battle with tech industry rival Oracle, a complex copyright case that was closely watched in Silicon Valley.

Oracle had said Google stole some of its Java software to create Android, the world's most popular smartphone operating system.

Some tech industry groups said Oracle's claim would undercut practices that are widely used to create all kinds of software.

Oracle had sought $9 billion in damages after saying Google, without Oracle's permission, copied certain elements of the Java programming language that helps different software programs talk to each other. Oracle said Google then reaped huge profits through ad sales on Google services like maps and search engines on Android phones and tablets.

But jurors found Google didn't need Oracle's permission to use certain elements of Java. The jury agreed with Google attorneys who argued that copyright law allows "fair use" of the Java elements because they were a small part of a much larger system of software that Google created for a new purpose.

The jury's verdict on Thursday marks Google's second victory in the case. U.S. District Judge William Alsup sided with Google in 2012, ruling that the Java elements — known in the industry as Application Programming Interfaces, or APIs — weren't protected by copyright. But an appellate court overturned Alsup's ruling and sent the case back for a second trial.

Oracle, which acquired the rights to Java when it bought Sun Microsystems in 2010, on Thursday immediately vowed to appeal.