ALEXANDRIA, Virginia (CNN) -- A former CIA officer who pleaded guilty to identifying a secret agent was sentenced Friday to 30 months in prison, but he says he came out of court "positive and optimistic."
John Kiriakou and prosecutors agreed on the term as part of a plea agreement he struck in October.
Defense attorney Robert Trout said during the sentencing hearing that Kiriakou did not intend to harm anyone or his country.
Trout described Kiriakou as "really thoughtless and really naïve" in not realizing that he would lose control of the information once he divulged it.
Kiriakou, 48, declined to speak in the Alexandria, Virginia, federal courtroom before his sentencing by U.S. District Judge Leonie Brinkema.
"All right, perhaps you've already said too much," Brinkema said.
However, soon thereafter, Kiriakou spoke briefly outside the court, thanking his lawyers, wife and supporters, including CIA co-workers he said had privately backed him.
Brinkema rejected defense attempts to characterize Kiriakou as a whistle-blower, and said he would have gotten more time had he been convicted at trial.
"This case is not a case about a whistle-blower. It's about a person who betrayed a very solemn trust," Brinkema said.
The Justice Department said Kiriakou also admitted to other allegations, including illegally telling reporters the name of a different CIA employee involved in a 2002 operation to capture alleged al Qaeda terrorist Abu Zubayda, and lying to a review board about a book he was writing.
The judge is allowing Kiriakou to surrender to authorities at a later date to serve his sentence.
Charges against Kiriakou followed an investigation that began when lawyers for detainees at Guantanamo Bay, Cuba, issued a court filing with classified information not provided by the government.
A probe found that defense lawyers got the information from a journalist, who got it from Kiriakou, the Justice Department said.