WASHINGTON — A former CIA agent has pleaded guilty to revealing the name of an undercover agent in the first such prosecution in 27 years, the US intelligence agency said Tuesday.

Ex-agent John Kiriakou, 47, who worked for the CIA from 1990 to 2004, was sentenced to 30 months in prison under the plea bargain agreement at a federal court.

He acknowledged having revealed to a reporter the identity of an undercover officer involved in harsh interrogations of suspected al-Qaeda members held at secret CIA detention facilities.

Kiriakou made headlines in December 2007, when George W. Bush was president, by saying in an ABC television interview that waterboarding -- a technique that simulates drowning -- had been used against a Guantanamo Bay detainee named Abu Zubaida.

CIA director David Petraeus issued a statement welcoming the plea bargain agreement with Kiriakou, even though four other charges were dropped.

The case "marks an important victory for our agency, for our intelligence community, and for our country," Petraeus said.

He added: "Oaths do matter, and there are indeed consequences for those who believe they are above the laws that protect our fellow officers and enable American intelligence agencies to operate with the requisite degree of secrecy."

This was the first time in 27 years someone has been found guilty of revealing the name of an undercover agent, the director said.

In 1985, CIA agent Sharon Scranage pleaded guilty to having told her boyfriend the names of other agents, and was sentenced to five years in prison, according to Steven Aftergood of the Federation of American Scientists.

Back in April, Kiriakou had refused to plead guilty as he went before a federal court in Alexandria, Virginia. The plea bargain averts a trial whose outcome was uncertain for him.