Former Goldman Sachs director Rajat Gupta caught a huge break yesterday as Southern District Judge Jed Rakoff sentenced him to two years in prison for feeding inside information to Galleon Group hedge fund founder Raj Rajaratnam.

Rakoff (See Profile) rejected a guidelines range of 78 to 97 months as an irrational result because it was driven by the amount of money involved in Rajaratnam’s trades and it was Rajaratnam, not Gupta, who made money on both bad and good news coming from within the secret confines of Goldman Sachs’ boardroom. The judge said two years was enough to send a message of deterrence to would-be insider traders.

Rakoff ordered the sentence, set to begin on Jan. 8, after taking into account Gupta’s charitable giving through organizations such as the Global Fund to Fight AIDS, Tuberculosis and Malaria. Rakoff said Gupta had extended a “big heart and a helping hand” to millions.

Read pre-sentencing memoranda from Gupta and prosecutors.

But “the picture darkens considerably,” Rakoff said, when one considers the conduct of the defendant on Sept. 23, 2008, when, at the height of the financial crisis, 23 seconds after a Goldman meeting in which it was learned that Berkshire Hathaway’s Warren Buffett was pumping $5 billion into Goldman, Gupta called Rajaratnam, who turned around and bought hundreds of thousands of shares of Goldman before the market closed.

This, the judge said, was “disgusting” and “the functional equivalent of stabbing Goldman in the back.”

Nonetheless, after taking several shots at the guidelines overemphasis on using the amount of money involved in white-collar cases to set the range, Rakoff went for a non-guidelines sentence that stands in stark contrast to the 11 years Rajaratnam is serving.

Defense attorney Gary Naftalis had asked that Gupta be allowed to perform extensive community service, for example, by working to battle disease in Rwanda.

But Rakoff, while saying he didn’t mean to sound pejorative, said the proposal struck him as sort of a “Peace Corps for insider traders.”

Anyway, the judge said, given that Gupta had such an exemplary record of good works, “he can be counted on to devote himself to community service” when he emerges from prison.

Gupta, 63, was convicted June 15 of conspiracy to commit securities fraud and three substantive counts of securities fraud. The jury acquitted him on two counts.

He is one of 69 people to be convicted or plead guilty during an unprecedented three-year run of insider trading prosecutions in the Southern District, with the central figure being Rajaratnam.

U.S. Attorney Preet Bharara issued a statement saying that Gupta “now must face the grave consequences of his crime—a term of imprisonment.”

Bharara added, “We hope that others who might consider breaking securities laws will take heed from this sad occasion and choose not to follow in Mr. Gupta’s footsteps.”

Yesterday, Naftalis’ argument for a non-guidelines sentence began with the Probation Department’s statement that Gupta’s crimes were an aberration. He then moved to the list of some 400 letters sent to the court vouching for Gupta, including letters from Microsoft Chairman Bill Gates and former U.N. Secretary General Kofi Annan. Annan wrote of Gupta, “Millions of people are alive today because of his leadership.”

“A life well-lived, a life of giving back,” said Naftalis.

Naftalis, of Kramer Levin Naftalis & Frankel, also said a non-custodial sentence was warranted because his client, a former three-term head of McKinsey & Co. consulting group, had already suffered a spectacular fall.

Gupta alluded to this himself when he rose to speak to the judge for five minutes, delivering remarks filled with regret that stopped short of acknowledging responsibility.

“I regret terribly the impact of this matter on my family, friends and the institutions that are dear to me,” he said.

Gupta, whose family sat in the rows behind him, remained impassive throughout the court session.

But Assistant U.S. Attorney Richard Tarlowe, who prosecuted the case with Reed Brodsky, said Gupta’s “fall from grace” should cut the other way, because Gupta was “in such an extraordinary position of trust” that his conduct was all the more “shocking and remarkable.”

Rajaratnam was convicted in 2011 by a jury that heard 45 tape-recorded conversations, including one on Oct. 23, 2008, in which he could be heard telling a Galleon employee, “I heard yesterday from someone who’s on the board of Goldman Sachs that they are gonna lose $2 a share. The Street has them making $2.50.”

Rajaratnam dumped his entire stake in Goldman at the opening of trading on Oct. 24, selling 150,000 shares and avoiding over $3 million in losses when the share price dropped.

That same tape recording was played at Gupta’s trial, where the jury was given phone records showing that Gupta had called Rajaratnam on Oct. 23, the day before Galleon sold off Goldman shares

The jury also saw evidence of the Sept. 23, 2008 phone records following the good news about Warren Buffett and the almost immediate call to Rajaratnam.

Gupta was also convicted with the help of two government cooperators who have pleaded guilty, former Galleon trader Michael Cardillo, who shorted Procter & Gamble stock based on an alleged tip from Gupta, and Anil Kumar, a former director of McKinsey & Co.

Attorneys for Rajaratnam are scheduled to appear before the U.S. Court of Appeals for the Second Circuit this morning and argue his convictions should be vacated and that the government improperly obtained permission to wiretap his conversations, an investigatory technique once typically reserved for drug and organized crime cases.

One argument that Rajaratnam will make, as well as Gupta when it comes time for his appeal, is that then-Southern District Judge Gerard Lynch (See Profile) was not told about a parallel Securities and Exchange Commission probe into Rajaratnam’s activities when Lynch signed off on the warrant authorizing the wiretapping. Therefore, the argument proceeds, Lynch was not able to discern whether there was a less intrusive means of obtaining the information about Rajaratnam.

Hotly contested at trial, as well as at sentencing, was whether Gupta benefited financially from the tips.

At trial, Naftalis said his client did not make “one penny” from the trades, but the government insisted that Gupta earned compensation in a number of ways from his relationship with Rajaratnam.

But in his sentencing memorandum, Tarlowe noted that Gupta invested $10 million to obtain a 20 percent stake in a Rajaratnam controlled investment fund, served as founding partners with Rajaratnam in the private equity fund New Silk Route in 2006 and served as a board member of Galleon International, believing “he was going to receive a portion of the fund’s performance fees.”

Tarlowe estimated the gain from Gupta’s offenses as between $7 million and $20 million and a guidelines range of between eight years, one month to 10 years, one month in prison.

David Frankel of Kramer Levin, who also represented Gupta, argued that the government’s calculation of gain was way off, but the amount of gain or loss avoided had no impact on the judge, who repeatedly expressed his distaste for the guidelines that are ostensibly meant to promote uniformity in sentencing but end up creating “irrational” results.

Rakoff said there was no reason to believe Gupta would commit a crime again and that the focus was on general deterrence and fashioning an appropriate sentence.

And while he said Gupta’s crimes went to the heart of one of the country’s greatest strengths—the integrity of the markets—two years in prison was sufficient to send a message.