By Nate Raymond

NEW YORK (Reuters) - A former British and two Swedish citizens about to face trial on U.S. terrorism charges pleaded guilty on Tuesday to conspiring to provide material support to the Islamic militant group al Shabaab in Somalia.

Madhi Hashi, 25, whose U.K. citizenship was revoked in 2012, and Swedish citizens Ali Yasin Ahmed, 30, and Mohamed Yusuf, 32, pleaded guilty in federal court in Brooklyn, New York, to a single conspiracy count. The guilty pleas came just three hours before potential jurors were to receive questionnaires in preparation for a June 1 trial.

"I agreed along with others to provide support to a designated foreign terrorist organization by the United States, specifically al Shabaab in Somalia," Hashi said in court.

The deal will spare the men the 30-years-to-life in prison they faced if convicted on all of the charges against them.

Instead, the trio, Somalis by birth, will face a maximum term of 15 years in prison when U.S. District Judge John Gleeson sentences them on Sept. 25. The men also face deportation following their release.

Prosecutors said that from 2008 to 2012, the men participated in weapons and explosives training with members and associates of al Qaeda-allied al Shabaab and agreed to support its agenda.

The men also were deployed in combat operations to support al Shabaab's military action in Somalia and participated in a suicide bomber program, authorities said.

Al Shabaab has carried out attacks in Somalia and neighboring countries aimed at imposing its strict interpretation of Islamic law and overthrowing the Somali government.

The case involved no allegations the men intended any direct harm to the United States.

Susan Kellman, Ahmed's lawyer, said the men never intended to harm the United States, but wanted to go to Somalia "to fight for their country."

Acting U.S. Attorney Kelly Currie in Brooklyn said the men were committed supporters of a group that "has publicly called for attacks against the United States."

The three men were arrested in August 2012 by authorities in Djibouti after illegally crossing the border from Somalia on their way to Yemen to join al Qaeda in the Arabian Peninsula, prosecutors said.

After being questioned by Federal Bureau of Investigation agents, the men were turned over to U.S. authorities for prosecution.

(Reporting by Nate Raymond in New York. Editing by David Ingram and Andre Grenon)