WASHINGTON - Former CIA officer Jeffrey Sterling was sentenced Monday to 3.5 years in prison for leaking classified information to a New York Times journalist.

Sterling was convicted in January of revealing details of a botched US attempt during president Bill Clinton's administration to thwart Iran's nuclear program.

"The court has to impose a very clear message," US District Judge Leonie Brinkema said at Sterling's sentencing in the Washington suburb of Alexandria, Virginia.

Sterling, who had been free on bail pending sentencing, was told to report to a federal prison in his home state of Missouri to serve his sentence.

His conviction marked a victory for President Barack Obama's administration in its crackdown on whistleblowers.

The case had dragged on in court for years as prosecutors pressed Times journalist James Risen to reveal his sources. He refused to do so.

Risen was first subpoenaed in 2008, but he fought against it until the subpoena expired the following year.

President Barack Obama's administration subsequently took the unusual step of renewing the subpoena in 2010. The legal fight ended seven years after the original subpoena, in January this year, after Attorney General Eric Holder said prosecutors would not force Risen to reveal his sources after all.

Sterling's 42-month prison sentence contrasted sharply with the two years' probation and $100,000 fine given to disgraced former CIA chief David Petraeus for sharing classified information with his mistress.

"I'm satisfied that a higher sentence is appropriate in this case because (Petraeus) admitted his guilt," Brinkema said.

Dana Boente, the US district attorney for eastern Virginia, welcomed Sterling's sentence in a statement issued shortly after it was handed down.

"For his own vindictive purposes, Jeffrey Sterling carelessly disclosed extremely valuable, highly classified information that he had taken an oath to keep secret," Boente said.

"His attempt to leverage national security information for his own malicious reasons brought him to this sentence today."

From November 1998 through May 2000, Sterling was assigned to a classified clandestine operational program designed to undermine the Iranian nuclear program, officials said.

In 2000, he filed a complaint against the Central Intelligence Agency alleging racial discrimination.

Prosecutors claimed that Sterling disclosed classified information in retaliation for the CIA's refusal to settle the lawsuit.

Prosecutors ultimately dropped their attempts to call Pulitzer Prize-winning Risen to testify after it became clear he would not reveal his sources, even if jailed, for his account of the bungled CIA operation described in his 2006 book, "State of War."

The case sparked outcry among media watchdogs, with more than 100,000 supporters signing an online petition delivered to the US Justice Department calling for an end to the prosecution.