NEW YORK - The United States transferred the first detainee from Guantanamo Bay on Tuesday to stand trial in a U.S. civilian court in a test case for President Barack Obama's plans to close the controversial prison for foreign terrorism suspects.

Ahmed Khalfan Ghailani, a Tanzanian held at the U.S. naval base in Cuba since 2006, pleaded not guilty in Manhattan federal court to charges of conspiring in the 1998 bombings of U.S. embassies in Tanzania and Kenya that killed 224 people.

He had been escorted to New York by U.S. marshals, the Department of Justice said.

Bringing Ghailani to the United States and putting him on trial in a civilian court will test Obama's contention that some of the roughly 240 detainees at the camp can be safely prosecuted and imprisoned in the United States.

Republicans have criticized the president's plan to transfer Guantanamo suspects to the United States. This is the first step in the Democrats' plan to import terrorists into America, House of Representatives Republican leader John Boehner said in a statement.

Civil liberties advocates say Obama should bring all Guantanamo detainees into U.S. civilian courts.

Ghailani faces 286 counts, including charges of conspiring with Osama bin Laden and other members of al Qaeda to kill Americans, and separate charges of murder for each of the 224 people killed in the August 7, 1998, bombings.

Ghailani was brought into the courtroom wearing a blue jail uniform and appeared relaxed. Judge Loretta Preska asked him how he would plea, and he said, Not guilty in English. At other points, he spoke in Swahili through a court interpreter.

Ghailani's military defence attorneys, Jeff Colwell and Rick Rider, said their application to assist in Ghailani's defence is pending before the U.S. defence department.

We hope he gets his day in court and we hope he gets a fair trial, Colwell told reporters on the courthouse steps. It is a good thing for the rule of law. He's in an established court, with established procedures. Not in kind of the limbo that he's been in for so many years.

Ghailani was transferred three weeks after Obama laid out his plans for closing the Guantanamo camp by January 2010. The prison, long condemned by human rights groups, was opened in 2002 under President George W. Bush after the September 11, 2001, attacks on the United States.

HELPING IN TANZANIA BOMBING

Ghailani is charged with helping to buy a truck and oxygen and acetylene tanks used in the Tanzania bombing, and of loading boxes of TNT, detonators, and other equipment into the back of the truck in the weeks immediately before the bombing.

At a 2007 hearing at Guantanamo Bay to determine that he was an enemy combatant and thus eligible to be held at Guantanamo, Ghailani confessed and apologized for supplying equipment used in the Tanzania bombing but said he did not know the supplies would be used to attack the embassy, according to military transcripts.

Republican congressional leaders were quick to criticise Ghailani's transfer, saying it endangered U.S. security and was opposed by most Americans.

But Attorney General Eric Holder said in a statement the Justice Department had a long history of securely detaining and successfully prosecuting terror suspects and it could be repeated in this case.

Four other co-conspirators in the bombings were tried and convicted at the same federal court in New York in 2001.

The American Civil Liberties Union has called on the Obama administration to go further.

Trying terrorists in federal court is the legal and the wise way to address the remaining Guantanamo detainees, said Jonathan Hafetz, staff attorney at the ACLU's National Security Project. The federal prosecutions stand in contrast to the failed military commission system that the Obama administration said it's reviving.

In a speech on Guantanamo last month, Obama said detainees could be tried in U.S. criminal courts, released or sent to other countries, or tried in revised military tribunals. There was also a category of inmates he considered too dangerous to be released or prosecuted.

(Writing by Anthony Boadle; additional reporting by Martha Graybow; editing by Daniel Trotta and Mohammad Zargham)