A Somali national indicted on federal terrorism charges pleaded guilty nearly a year and a half ago, Justice Department officials announced Monday, disclosing a previously secret agreement with prosecutors.

Ahmed Abdulkadir Warsame was captured in the Gulf of Aden by the U.S. military in April 2011 and held for questioning aboard a U.S. Navy ship for more than two months. He was charged with providing material support to the Islamist militant group al-Shabab and al-Qaeda in the Arabian Peninsula, conspiring to provide explosives training and committing other offenses.

He pleaded guilty in December 2011 in New York, according to the plea agreement released Monday. As part of the deal, Warsame agreed to cooperate with U.S. authorities and Justice Department officials agreed to take steps to try to ensure the safety of his family.

Officials touted the case as a counterterrorism success that blended civilian and military options in an incident involving a foreign militant.

“The capture of Ahmed Warsame and his lengthy interrogation for intelligence purposes, followed by his thorough questioning by law enforcement agents, was an intelligence watershed,” said Preet Bharara, the U.S. attorney for the Southern District of New York.

A Justice Department official said prosecutors withheld disclosure of Warsame’s plea out of concerns that their ability to obtain information from him could have been jeopardized had court documents been unsealed earlier.

“Once the U.S. government determined that sealing was no longer justified as necessary in order to further those continuing benefits, his case was unsealed,” said the official, who spoke on the condition of anonymity because he was not authorized to speak about the case. “His cooperation has been and continues to be enormously valuable.”

Republican lawmakers have criticized the Obama administration for bringing alleged terrorists to the United States for trial in civilian court rather than using criminal tribunals. Last week, U.S. authorities announced that they had indicted a Nigerien citizen on terrorism charges in federal court in New York.

Ibrahim Suleiman Adnan Adam Harun is accused of fighting U.S. troops in Afghanistan and planning to bomb U.S. diplomatic facilities in Nigeria.

“We are deeply concerned that this Administration’s pattern of rushing to indict foreign enemy belligerents like Ibrahim Suleiman Adnan Adam Harun in civilian court — rather than detaining them in military custody at Guantanamo — has undermined our nation’s intelligence collection efforts and made our country less safe,” Sens. John McCain (R-Ariz.), Lindsey O. Graham (R-S.C.) and Kelly Ayotte (R-N.H.) said in a statement.

Disclosure of Harun’s detention came less than three weeks after U.S. authorities said they had captured a former spokesman for al-Qaeda and secretly transferred him to New York to face a criminal trial.

According to the nine-count indictment in the Warsame case, he fought as a soldier on behalf of al-Shabab in Somalia in 2009 and provided explosives, weapons and training to the group. From 2007 until April 2011, when he was captured at sea, Warsame, who is in his mid-20s, conspired with others, including American citizens, to provide support to the terrorist organization, the indictment said.

Warsame also brokered a weapons deal for al-Shabab to purchase weapons directly from al-Qaeda in the Arabian Peninsula, according to the indictment, and from 2009 to 2011, Warsame worked with others, including American citizens, to provide money, training, communications equipment and personnel to AQAP.

While Warsame was in Yemen in 2010 and 2011, he also received weapons, explosives and other military-type training from the terrorist group.

Justice Department officials said he faces the possibility of life in prison.