(Bloomberg) -- Google could owe Oracle Corp. billions of dollars after an appeals court said it didn’t have the right to use the Oracle-owned Java programming code in its Android operating system on mobile devices.

Google’s use of Java shortcuts to develop Android went too far and was a violation of Oracle’s copyrights, the U.S. Court of Appeals for the Federal Circuit ruled. The case was remanded to a federal court in California to determine how much the Alphabet Inc. unit should pay.

The dispute is over pre-written directions known as application program interfaces, or APIs, which can work across different types of devices and provide the instructions for things like connecting to the internet or accessing certain types of files. By using the APIs, programmers don’t have to write new code from scratch to implement every function in their software or change it for every type of device.

The case has divided Silicon Valley for years, testing the boundaries between the rights of those who develop interface code and those who rely on it to develop software programs.

Bloomberg

Oracle said its APIs are freely available to those who want to build applications for computers and mobile devices, but draws the line at anyone who wants to use them for a competing platform or to embed them in an electronic device. It said it was entitled to $8.8 billion in damages from Google during the 2016 trial.

“The fact that Android is free of charge does not make Google’s use of the Java API packages noncommercial,” the Federal Circuit ruled, noting that Android had generated more than $42 million in revenue from advertising. It also said that Google had not made any alteration of the copyrighted material.

Officials with the two companies didn’t immediately respond to requests for comment.

Oracle claims Google was in such a rush in the mid-2000s to create an operating system for mobile devices that the company used key parts of copyrighted Java technology without paying royalties. Google, which gets the bulk of its profit from selling advertisements connected to search results, faced an “existential threat” because its search wasn’t optimized for mobile devices, according to Oracle.

Google countered that Oracle was just jealous because it did what Oracle could not -- develop an operating system for mobile devices that was free and wildly popular. Google said it used a minuscule percentage of Oracle’s code, only enough to enable programmers to write applications for Android in the Java language.

A federal jury in California agreed in 2016, saying Google’s actions were a “fair use” that was exempt from copyright law. Tuesday’s Federal Circuit opinion reverses that verdict.

“There is nothing fair about taking a copyrighted work verbatim and using it for the same purpose and function as the original in a competing platform,” the appeals court ruled.

In a closely watched 2014 decision in the dispute, the Federal Circuit said the APIs were entitled to copyright protection.

Java was created by Sun Microsystems Inc. in the 1990s, and some have accused Oracle of violating Sun’s pledge to ensure that Java is widely available. Oracle bought Sun in January 2010 for $7.4 billion and sued Google less than eight months later.

Among Oracle’s supporters in the case is Sun co-founder Scott McNealy, who said Java was created to be a platform-neutral system where programmers could “write once, run anywhere.”

Java “is the foundation upon which our digital world is built,” McNealy said in a filing with the court. “Google stole that foundation, used it to build Android, and destroyed Oracle’s market in the process.”

Mozilla Corp., which makes the Firefox internet browser using an open-source software, said Google’s actions were in line with the “the fundamental purpose of copyright, which is to promote creative works” and said a victory for Oracle would have far-reaching implications.

“Technology will be less inclusive, slower to develop and more expensive,” Mozilla said in a filing with the court. “There must be latitude for such uses of code to be fair so that the software industry can continue to flourish.”

Part of Google’s defense focused on the idea that Java was developed for desktop computers, while Android was created for phones and other mobile devices. Oracle sought to extend the case to desktops, where Android is now available, but the trial judge said he wanted to keep the case narrowly focused.

The case is Oracle America Inc. v. Google Inc., 17-1118, U.S. Court of Appeals for the Federal Circuit (Washington). The trial court case is Oracle America Inc. v. Google Inc., 10cv3561, U.S. District Court for the Northern District of California (San Francisco).

Bloomberg News