Handing a huge win to Google (GOOG), a federal judge Thursday cleared away Oracle’s (ORCL) last big claim in a high-stakes lawsuit over Android, the Google software that has become the world’s most popular smartphone operating system.

Oracle promptly vowed to appeal. But the ruling by U.S. District Judge William Alsup, who decided that federal copyright law doesn’t apply to Google’s use of key elements of Oracle’s Java programming system, means for now that Oracle will collect only minor damages in a case in which it once sought up to $6 billion.

“This is now effectively a total loss for Oracle, across the board,” said Brian Love, a Stanford Law School expert on technology and intellectual property law. “It’s absolutely the best possible case for Google.”

Oracle can still seek damages for some copyright violations that were previously found in the case. But both sides had agreed those violations were relatively minor, involving only a handful of files that make up a tiny percentage of the Android program. Under a previous agreement between the parties, the judge will decide on awarding statutory damages, which the law sets at a maximum of $150,000.

Alsup has already released the jury that rendered partial verdicts during a weeks-long trial of the complex case, in which both sides fielded squads of high-priced attorneys and sent their top executives to testify. On a single day early in the trial, jurors heard from two of Silicon Valley’s best-known billionaires — Oracle CEO Larry Ellison and Google CEO Larry Page.

Ultimately, the jury found some copyright infringement while rejecting other claims that Android violated patents and copyrights for the Java programming system, which Oracle acquired when it bought Sun Microsystems in 2010. The jury also deadlocked on the question of whether Google’s use of some Java elements was protected by the legal defense of “fair use.”

But the judge had reserved for himself the final decision on whether copyright law even applies to the structure and design of crucial elements of Java known as Application Programming Interfaces, or APIs, which were at the heart of Oracle’s case.

That issue has been closely watched across the tech industry, where some experts have warned that applying copyrights to APIs would create unreasonable legal hurdles for developers who use APIs to build new software applications.

Alsup gave a nod to that concern in his written decision Thursday. “To accept Oracle’s claim would be to allow anyone to copyright one version of code to carry out a system of commands and thereby bar all others from writing their own different versions to carry out all or part of the same commands,” he wrote. “No holding has ever endorsed such a sweeping proposition.”

But the judge was careful to keep his 41-page order narrowly focused. At several points, he emphasized that virtually all of Google’s Android code was written independently, without copying Oracle’s proprietary software. And he concluded that the structure of the disputed APIs amounted to an organizing “system” or “method of operation,” which is explicitly exempted under U.S. copyright law.

“This order does not hold that Java API packages are free for all to use without license,” Alsup wrote. “Rather, it holds on the specific facts of this case, the particular elements replicated by Google were free for all to use under the Copyright Act.”

Even so, the two sides in the fight responded with statements as sweeping as the rhetoric that accompanied the dispute all along.

A Google spokesman hailed the decision as a victory “for collaboration and innovation.” Oracle, meanwhile, criticized the judge’s findings in a statement that said the ruling could “make it far more difficult to defend intellectual property rights against companies anywhere in the world.”

In addition to seeking billions in damages, Oracle had hoped to win a court order that would force Google to rewrite Android or pay Oracle a share of its future advertising profits from Android mobile gadgets. That could have been a major setback for Google, which has bet its future growth on a strategy that relies on Android to draw mobile Internet users into a variety of other Google services.

While the loss might be a blow to Oracle’s prestige, analysts were split on whether it will have a financial impact on Oracle’s business.

“I don’t see it as a material loss for them right off the bat, other than their legal expenses,” said Al Hilwa, a software industry expert at the IDC research firm.

Gartner analyst Mark Driver, however, said in a recent interview that a loss for Oracle could encourage other companies to find new ways of using Java programming tools without paying Oracle for a license. That could erode Oracle’s control over Java and potentially cut into future revenue, he said, although Java is not a major source of Oracle’s earnings.

Contact Brandon Bailey at bbailey@mercurynews.com; follow him at Twitter.com/BrandonBailey.

A new report says Facebook CEO Mark Zuckerberg has gone to "war" in response to criticisms of the company. And his new approach has led to friction with several top executives, including Sheryl Sandberg.