Oracle and Google are in the courtroom again — the same court they started in back in 2010, when Oracle first sued Google over the company’s use of 37 Java APIs in its Android operating system. The case, first decided in favor of Google, bounced up to an appeals court and was reversed, then appealed to the Supreme Court, which declined to hear the case. Now Oracle’s lawsuit, which could net the company $9 billion, is back where it started in U.S. District Court.

But this time, instead of debating whether Google infringed on Oracle’s copyright when it used the Java APIs in Android, the two companies are arguing over whether Google’s coding falls under fair use. And while Oracle is hitting hard on the four legal measures for fair use, its lawyers and witnesses are also working to portray Oracle as a defender of free and open source software.

It’s an image that will be tough to square with the reputation Oracle has developed during this case as a corporate fist clamping down on open source. A long list of computer scientists have opposed Oracle, saying that the company’s position will cause far-reaching harm to the open source community.

But Oracle co-CEO Safra Catz testified Monday and Tuesday this week that it was Google, not Oracle, that locked its software away within a walled garden.

Google says the open source nature of Java is what led the Android team to embrace its APIs. But Catz claimed that the only way to preserve Java’s longstanding “write once, run anywhere” philosophy was to protect the language from interlopers like Google, which, in Oracle’s view, warped it into non-compatible form with Android.

Oracle began telling its side of the story yesterday when Catz took the stand. Catz, who shares Oracle’s chief executive role with Mark Hurd, said that Oracle’s decision to purchase Sun Microsystems in 2009 was largely motivated by a desire to protect Java and preserve the programming language for fair and open use.

Catz testified that, when Sun’s stock slid in the mid-2000s, she began to fret about the fate of Java. Oracle was already using Java to build software and Catz was concerned that, if Sun tanked, Oracle’s go-to programming language would falter.

“We were concerned [Sun] wouldn’t invest enough, and Java was critical for our product,” Catz said.

So, in order to avoid losing Java to decay or to a competitor, Oracle started trying to buy it. Catz explained that Oracle started small, offering to purchase only Java and some other pieces of Sun’s software business, only to be rebuffed. When it became clear that IBM might buy Sun, hardware and all, Oracle came back to the table with $7.4 billion and beat IBM’s offer of $7 billion to buy the entire company.

At the time of the purchase, Oracle’s then-CEO Larry Ellison called Java the “single most important software asset we have ever acquired.” (Ellison is now Oracle’s chairman.) Catz echoed his remark in court on Monday, adding that she recommended the acquisition to Ellison and planned to grow Java once it was brought in-house. “We intended to invest in Java and bring the Java community together and come out with new versions of Java going forward,” Catz said.

Catz testified that Google’s use of Java in Android became a topic of conversation at Oracle soon after the acquisition. She said Sun’s former CEO, Jonathan Schwartz, told Oracle that he had been in negotiations with Google to get the company to purchase a license for its use of Java. (Schwartz testified on behalf of Google in the case.)

But, by the time Oracle’s deal with Sun closed in early 2010, Catz said Android’s effect on the openness of Java was too large to reverse. She claimed today that the entire community of Java programmers had been split in two, with some of the programmers switching to the Android platform and thereby limiting the universality of Java. With Java, Catz said, “They could write it once and run it anywhere. Once you write it in Android, you can’t run it on anything but Android.”

It’s a bit of a rhetorical leap to characterize Android, a free and open platform, as one that’s restrictive of development. Google’s attorneys pushed back on this assertion during their questioning of Catz, suggesting that Oracle didn’t fully understand the open nature of Java and that executives were either unprepared to manage an open source platform, or had every intention of restricting use of Java.

Google’s lawyers also questioned Catz about Oracle’s own efforts to develop a smartphone, a plan that Oracle considered soon after the acquisition of Sun but ultimately abandoned. At one point, attorneys displayed a slide from an internal Oracle presentation on phone development that read in part, “Oracle has very limited internal expertise to make smart decisions.”

Google made some headway in suggesting that Oracle only chose to sue after its efforts to make a smartphone failed, showing emails between Ellison and Alphabet executive chairman Eric Schmidt that indicated the pair were meeting just months before Oracle filed its suit. Google also referenced Ellison’s now-infamous remarks at a JavaOne developers’ conference, when he indicated he was happy with Google’s implementation of Java. “I think we can see lots and lots of Java devices, some coming from our friends at Google,” Ellison said.

Whatever friendship existed between Oracle and Google executives has long since withered. Catz testified that Google’s general counsel Kent Walker approached her at a bat mitzvah in March 2012 to discuss the lawsuit. According to Catz, Walker said, “Google is a very special company and the old rules don’t apply to us.”

Catz fired back with one old rule: “Thou shalt not steal.”

She testified that Google’s alleged infringement has cost Oracle hundreds of millions of dollars, including in a bargain basement deal with Amazon for use of Java in the development of Paperwhite.

Testimony in the case is scheduled to continue this week, with closing arguments expected to begin next week.