Supreme Court justices pressed Google on Wednesday to explain why its use of software code to develop its Android mobile operating system didn’t amount to theft, in a closely watched case that could determine how copyright law applies to software.

Oracle has alleged in the decade-old case that Google infringed on copyrights related to using roughly 11,000 lines of code from the Java programming platform to develop Android. Oracle, which acquired Java in 2010 when it bought Sun Microsystems, has sought $9 billion in damages, arguing that Google used the code without its permission.

Google argued that weaving that code into Android was protected under the “fair use” doctrine that allows the unlicensed use of copyright-protected work in circumstances, such as this case, when there is no other way to do it. But at the start of Google’s presentation, Chief Justice John G. Roberts Jr. challenged that assertion.

“The only reason there is only one way to do it is because some of Oracle’s product expression was very successful,” Roberts said. “There were a lot of ways to do it when they did, and the fact that the programmers liked it and that is what everybody used — it seems a bit much to penalize them for that.”

The case, which has broad ramifications for the software industry, has bounced around various courts over the years. In 2016, jurors ruled Google’s use of the Java code was permitted as fair use under federal copyright law. Two years later, a federal appeals court overturned that, ruling that 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 dispute centers on the technical way software developers use application programming interfaces, or APIs. That’s the computer code that enables websites and applications to work together. APIs also reduce the amount of basic computer coding developers need to write with each program.

Justice Sonia Sotomayor pressed Google on why it needed to use the Java code to develop its mobile operating system when Apple, which developed the competing iOS technology, did not.

“They spent the billions of dollars necessary. Presumably, you could have,” Sotomayor said.

But the code was so basic to the way applications interoperate with Android that Google had no other choice but to use the Java code, its lawyer Thomas Goldstein said.

“We couldn’t write a computer program that would respond to the developers’ instructions without reusing this limited set of instructions,” Goldstein said.

Justice Neil M. Gorsuch pressed Goldstein on a similar point, that because Java was more “particularly elegant, efficient or successful,” Google wanted to “ride on their innovation.”

Questioned later by Justice Elena Kagan, Goldstein described the Java code that Google used as “connective tissue between computer programs,” adding that “it is at the most barely creative.”

Google has won the support of several tech companies, including Microsoft, which argued in its own brief that the appeals court ruling in Oracle’s favor “risks upsetting long-settled expectations” that have allowed the tech industry to flourish by enabling programs to interoperate.

Oracle’s toughest questioning came from Justice Stephen G. Breyer, who wondered whether the code that Google used was more like the development of the “QWERTY” keyboard, something of a utility that isn’t deserving of copy protection and would disrupt the marketplace if companies needed to license it.

“At this point in time, it’s really tough, just like the QWERTY keyboard, to go backwards,” Breyer said. “And very bad consequences will flow if you don’t see that distinction.”

Oracle lawyer Joshua Rosenkranz countered that the analogy wasn’t apt.

“This is not like the QWERTY keyboard. There was never anything expressive in QWERTY,” Rosenkranz said. “It was purely mechanical.”

The solicitor general, who represents the federal government before the court, filed a brief in support of Oracle’s case and presented an oral argument on the company’s behalf.

Breyer pressed the government on his QWERTY keyboard analogy, as well, asking if a ruling in Oracle’s favor would be akin to giving monopoly power over something that is already in wide use. Unlike the Java code Google used, the QWERTY keyboard is “not sufficiently creative," deputy solicitor general Malcolm Stewart argued.

Oracle has long had a close relationship with the Trump administration, and separately is seeking to secure a stake in the popular video app TikTok, which has sought U.S. investors to stave off a ban in the country over President Trump’s security concerns.