When Apple goes before a federal appeals court on Dec. 15, trying to overturn the ebooks price-fixing judgment the Justice Department won against it in July 2013, there will be an elephant in the room.

That would be Amazon, the much admired and greatly feared ­discounter, which is not a party in the case. Yet the unposed question hovering over the proceedings will be: Did the regulators target the right bully?

The case stems from events that occurred five years ago, when Apple was preparing to launch its first iPad. Apple’s negotiator extraordinaire, Eddy Cue, signed up five of the then six major publishing houses to start selling ebooks through what it would call the iBooks Store.

Apple AAPL was breaking into a market then dominated by Amazon, which had an 80% to 90% market share—monopoly power in almost anyone’s book. The iPad’s new color touchpad e-reader would compete with Amazon’s Kindle 2, a black-and-white, text-only, single-use device that advanced pages with a button. So far so good.

But when the curtain rose on the iBooks Store on April 3, 2010, so did prices industrywide for most new-release ebooks, to the tune of about 17%.

That dramatic price rise—and a letter Amazon AMZN wrote to regulators two months earlier—led the Justice Department and 33 state attorneys general to sue Apple and five publishing houses for horizontal price-fixing in violation of the ­Sherman Act. In July 2013, after a three-week trial, U.S. District Judge Denise Cote of Manhattan ruled against Apple. (The publishers settled before trial.)

This is the stain on its reputation that Apple hopes the appeals court will wash away. The man at the center of the dispute, Apple’s Cue, 50, has agreed, in a Fortune exclusive, to grant his first press interview on the subject. An Apple lifer since he was 24, Cue now oversees iCloud, Siri, and all the company’s online stores. It was Cue who conducted the negotiations that led to the launch of the iTunes store in 2003, the App Store in 2008, and Apple’s new digital-­payment product, Apple Pay, in October. And it was he who negotiated Apple’s entry into the ebooks market in 2010.

“Is it a fact that certain book prices went up?” asks Cue. “Yes. If you want to convict us on that, then we’re guilty. I knew some prices were going to go up, but hell, the whole world knew it, because that’s what the publishers were saying: ‘We want to get retailers to raise prices, and if we’re not able to, we’re not going to make the books available digitally.’ At the same time, other prices went down too, because now there was competition in the market.”

Many are surprised Apple didn’t settle long ago. The case seems to be more about reputation than money. (Under a conditional settlement worked out in June, if Apple loses the appeal, it will pay $450 million in damages and attorney fees. If it wins, it pays nothing.)

“We feel we have to fight for the truth,” says Cue. “Luckily, Tim feels exactly like I do,” he continues, referring to Apple CEO Tim Cook, “which is: You have to fight for your principles no matter what. Because it’s just not right.”

It’s a risky choice, since a loss would only set the stain. “Apple has an uphill battle,” says Herbert Hovenkamp, a law professor at the University of Iowa and co-author of a 22-volume antitrust treatise. “There was lots of evidence in the record, the judge looked at it, and she agreed with the government. Fact-findings get reviewed under a deferential standard. You pretty much have to accept them.” (It was a bench trial, meaning that Judge Cote herself, not a jury, was the fact-finder.)

Still, the issues are perplexing, and Apple has a fighting shot. Did prices go up because of price-fixing? Or did they go up, rather, because once Apple entered the market, the publishers finally had an alternative to selling through Amazon on whatever terms it demanded?

Apple’s lawyers will argue that Judge Cote’s ruling “turns the antitrust laws upside down,” as its brief asserts, because its entry into the market “kick-started competition,” thereby “delivering higher output, lower price levels, and accelerated innovation.” (Notwithstanding the price rise in key categories of books, prices fell overall, its expert testified.) Its case before the U.S. Court of Appeals for the Second Circuit will be argued by Theodore Boutrous Jr. of Gibson Dunn & Crutcher.

The government fires back that anything positive that came from Apple’s entry into the market bore no connection to the price-fixing and is no excuse for it, as it argues in its brief, and that the court should defer to Judge Cote’s “amply supported and well-reasoned decision.” Deputy U.S. Solicitor General Malcolm Stewart will present its case.

Meanwhile, Amazon has given the appeal new timeliness by continuing to shock the squeamish with its big-footing of suppliers, flexing muscles only fortified by Cote’s judgment against Apple. In May, as it negotiated a new contract with Hachette Book Group (a settling defendant in the ebooks price-fixing case), Amazon pulled the preorder buttons on most Hachette titles, stopped recommending its authors’ works, and burdened Hachette’s books with artificial delivery delays. Since Amazon still holds close to 65% of the ebook market and its share of the total book market has climbed to 40%, according to Codex Group, it wields enormous leverage. Though Hachette and Amazon settled their differences in November, an authors group, which met with antitrust regulators in October, has vowed to press on. Amazon declined to comment.

In truth, though, anyone complaining about Amazon has a tough row to hoe. Since the 1970s a broad consensus has emerged that the only proper purpose of the antitrust laws is to protect consumers, and low prices are presumed to be the consumer’s highest priority. Under that regimen, gigantic discounters like Amazon seem to be golden.

This case may mark the high-water mark in that worldview, with regulators rushing to the rescue of a near monopolist against the alleged depredations of a new entrant.

In November 2009, Apple was finalizing its top-secret iPad, which was to be unveiled in January. “I remember taking it home to play with,” Cue recalls, “and it was clear to me it would make a great ebook reader.” So he suggested to CEO Steve Jobs that Apple open an ebook store along the lines of iTunes. “He said, ‘I’m not going to delay the product for this,’ ” Cue recounts, “ ‘but I’ll let you go see what you can get done.’ ”

Cue knew little about the industry and had never met any of the publisher CEOs. His team set up six meetings for him in New York—one with each CEO of a Big Six ­publisher—on Dec. 15 and 16. The publishers were Hachette, Harper­Collins, Macmillan, Penguin, Simon & Schuster, and Random House. Cue never met with more than one publisher at a time. (Penguin and Random House merged in July 2013.)

A few days before the first meeting, Cue recalls, he read a newspaper article about the “industry being in turmoil, Amazon selling books below cost, and the publishers saying that if the practice doesn’t stop, they’re going to stop selling new releases digitally. I thought, Oh, these are going to be more interesting meetings than I thought.”

Judge Cote later found that when Cue showed up at those first meetings, he immediately plunged his company into a price-fixing cabal. “Apple’s entry into the conspiracy had to start somewhere,” she wrote, “and the evidence is that it started at those initial meetings in New York City.”

To understand Cote’s perspective, we need to flash back to two years before Cue conceived of entering the ebook market.

Key exhibits
To prove price-fixing, the government displayed (below) the jumps in major publisher ebook ­prices after the iBooks Store opened in April 2010. Apple stressed that overall prices for all publishers (the black line) declined. To prove collusion, the government showed (above) that the publisher CEOs phoned each other while negotiating their contracts with Apple. It couldn’t prove, however, that Apple knew of these calls.

APL_E_BOOK_PRICES_WEBGraphic Source: Department of Justice

Amazon introduced the first Kindle in 2007. It hit the sweet spot with consumers and launched an industry—and a lawfully earned monopoly.

The publishers sold their digital works to Amazon on the same wholesale model they used for “ink on paper.” They were aghast, however, when Amazon started selling nearly every digital version of a new release or New York Times bestseller—which typically sold in hardback for $26 to $35—for just $9.99. The practice cannibalized hardback sales and devalued authors’ intellectual property, the publishers protested. Over time, they feared, Amazon would use its market power to force down wholesale prices, slashing the funds available for author advances.

From Amazon’s perspective, the price simply gained converts to a new way of reading, sold Kindles, and served the purpose of any loss leader: getting people to the store.

Though publishers raised wholesale prices, Amazon held fast. By 2009 it was absorbing $2, $5, and even $7 losses on the sale of nearly every copy of those key titles.

In their clubby world the publisher CEOs naively hobnobbed with abandon. Four times between September 2008 and September 2009, at least five of them supped together without lawyers present. Three of those dinners were in a private room at Picholine, a fine French restaurant on Manhattan’s Upper West Side. Though the participants gave innocuous reasons for the gatherings, the government said they “offered publisher defendants opportunities to discuss how they could work collectively in pursuit of higher retail e-book prices.”

Jeff Bezos, kindleJeff Bezos, founder and CEO of Amazon.com, introduced the Kindle on Nov. 19, 2007Photo By: Mark Lennihan—AP

There and elsewhere some publisher CEOs unquestionably shared sensitive business information, including plans about “windowing.” Windowing was one of the few weapons the publishers had against Amazon. It meant withholding the release of an ebook until several months after the hardback release—the way paperbacks are withheld. None of the publishers wanted to do that because they’d lose the benefit of the buzz surrounding a new release, and the practice invited piracy. But in early 2009 two publishers warned Amazon that they might resort to windowing certain blockbuster titles.

For Amazon CEO Jeff Bezos, whose whole vision was to create “The Everything Store”—the title that author Brad Stone chose for his eye-opening book about the company—­windowing was anathema. Bezos emailed a subordinate that windowing would be “an absolute declaration of war” that Amazon would not “tolerate,” and warned a publisher of “the nuclear nature of windowing, even on a single title.”

So the publishers faced a quandary. If a company started windowing, it risked retaliation from Amazon. But if publishers sought safety in numbers, coordinating their windowing, they would be colluding in violation of the Sherman Act.

In August, Hachette’s then CEO, David Young, sent an email that evinced collusion. “Completely confidentially,” he wrote the CEO of Hachette’s French parent, “[Simon & Schuster CEO] Carolyn [Reidy] has told me that they are delaying the new Stephen King … I think it would be prudent for you to double delete this from your email files when you return to your office.”

The next month Simon & Schuster did window King’s Under the Dome, and soon thereafter Hachette announced it would window a blockbuster of its own.

Three months later the pressure mounted. On Dec. 4, a Friday, Hachette told Amazon it would window many of its digital new releases for spring 2010. On Monday, Simon & Schuster followed suit. Later that week HarperCollins said that it would too. Newspapers heralded each dramatic step.

That a competitor follows another’s lead is not collusion. If one airline raises its fare on a route, for instance, and every other carrier matches that fare within minutes, that’s fine, as long as they didn’t agree to do it beforehand.

In this case, though, given the Picholine dinners and the “double delete” email, Judge Cote inferred that the ­publishers had “synchronized their windowing strategies.” But she went further: She found that Cue—who at this point had still never spoken to a single publisher—­somehow knew they were colluding. “Before Apple even met with the first publisher-defendant in mid-December,” she wrote, “it knew that [they] were already acting collectively to place pressure on Amazon to abandon its pricing strategy.” She cited only the fact that newspapers had reported each windowing announcement. (Cue says he never heard of the Picholine dinners until after the government sued in April 2012.)

Cue went to the first meetings with publishers mainly to listen and learn, he testified. He did convey, however, that the key terms of Apple’s deals with each publisher were going to be the same—just as they were at iTunes and the App Store. “It’s no different than it is with any other industry and Apple,” Cue says in an interview. “Today every bank has the same basic deal on Apple Pay. No different than TV, movies, anything else.” (Judge Cote acknowledged that negotiating from a standard contract was ordinarily lawful.)

Afterward, Cue returned to Cupertino to mull options. Though he’d originally planned to use a wholesale model, three publishers had urged him to consider agency. Otherwise they wouldn’t relinquish their right to window.

Jobs was as adamantly opposed to windowing as Bezos was. Cue decided to switch to agency, which Apple was already using at the App Store. He’d propose the same 30% commission it took there, which generated a profit margin in the low single digits. (Cote acknowledged that the agency model was lawful.)

With a 30% gross margin, Cue testified, Apple didn’t care how low the price was, because it could make money on anything—like the 99¢ songs it sold at iTunes. But he knew from his meetings with publishers that many wanted to price at levels both he and Jobs considered unrealistically high. So Cue decided to propose tiers of price caps, tied to the ­suggested hardback list prices. (Judge Cote acknowledged that price tiers and caps were lawful.) After the holidays Cue emailed term sheets to each publisher, setting out those principles.

But there was one more term. It read: “All resellers of new titles need to be in agency model.” The clause addressed the fact that if Apple was using agency (with publishers setting prices) while Amazon was using the wholesale model (with Amazon setting prices at $9.99), Apple’s prices wouldn’t be competitive. Most antitrust lawyers would say that this term was illegal, however, because Apple can’t tell its suppliers how to deal with Apple’s competitors.

As it happened, Cue quickly dropped that provision. He did so, he testified, not because of any antitrust issue, but because he realized it didn’t adequately protect Apple. If a publisher made such a commitment but later couldn’t persuade Amazon to switch to agency, what would Apple do? “We could terminate the agreement,” Cue says, “but now we’re still stuck with a bookstore that was uncompetitive and didn’t work.”

So when Cue sent out the actual draft contracts, he replaced that term with a “most favored nation” clause, or MFN. It gave Apple the right to match the price at which any new-release ebook was being sold by another retailer. (Cote acknowledged that MFNs are ordinarily legal.)

With the MFN, publishers could keep their wholesale model with Amazon, if they wanted. If they did, though, and Amazon priced a book at $9.99, Apple could sell that book at $9.99 too. In that case, of course, the publisher would make only 70% of $9.99 from Apple—about $7—instead of the $12 or $15 wholesale price it was used to getting for that book from Amazon. That would be the worst of both worlds for the publisher: It would still be stuck with the $9.99 price point, and it would be making less money too.

Faced with that prospect, it was foreseeable that publishers would probably either window all new-release ebooks to Amazon, or persuade Amazon to switch to agency.

Though the original, ill-conceived clause was replaced by the MFN, Judge Cote wouldn’t let Apple off the hook. Rather, she found that it was “never rescinded,” and lived on as an unwritten, wink-wink term in the conspiracy.

The government also argued—and Cote agreed—that under the unique circumstances of this case, the MFN was also illegal, because it “sharpened the publishers’ incentives” to switch to agency.

Negotiations continued down to the wire; the last publisher inked its deal only the day before Jobs unveiled the iPad at San Francisco’s Yerba Buena Arts Center. (Random House didn’t sign till a year later, so it wasn’t named in the government’s suit.)

At the launch Jobs showed how he could download a book from the iBooks Store. The volume chosen was priced at $14.99. Afterward, then Wall Street Journal columnist Walt Mossberg asked Jobs in a videotaped exchange: Why would someone buy for $14.99 a book that’s available on Amazon for $9.99?

“That won’t be the case,” Jobs responded. “The prices will be the same.”

steve jobs, apple, ipad ibooksSteve Jobs introduces the iPad’s iBooks app and the iBooks Store in January 2010.Photo By: Qi Heng—Xihhua Press/Corbis

To the government, that was a confession to price-fixing. But it was also just a description of how the MFN worked. If Amazon was still selling the book at $9.99, then the iBooks Store could sell it at that price too.

The day after the launch, Macmillan CEO John Sargent flew to Seattle to deliver Bezos a choice. Amazon could switch to agency, or it could stay on wholesale. But in the latter instance Macmillan would window all its digital new releases. “Amazon was clearly unhappy,” Sargent stated in his written testimony, “and spent a few minutes letting us know that before the meeting came to a close.”

The next day Amazon levied the maximum penalty: It removed the buy buttons on all Macmillan books, both digital and print. After a storm of bad publicity, Amazon agreed to switch to agency—though it kept Macmillan’s buy buttons off until a contract was signed on Feb. 5. At Amazon’s insistence, that contract included an MFN clause just like Apple’s.

When the iBooks Store opened, most of the five publishers’ new-release books were priced at or near the $12.99 or $14.99 price caps. That wasn’t surprising, given that the publishers wanted to price their books at higher levels. But given the uniformity, Judge Cote found that Apple had helped the publishers fix prices, not cap them.

Clearly, one can view this affair through very different prisms. Judge Cote saw it through one. Apple hopes the appeals court will view it through another.

As for Cue, how does he look back at this nightmare?

“If I had it to do all over again, I’d do it again,” he says. “I’d just take better notes.”

This story is from the December 22, 2014 issue of Fortune.