The Senate voted early Friday to reject a Republican effort to prohibit the United States from prosecuting foreign terrorist suspects in civilian courts, handing a victory to President Barack Obama.

By 52-47, senators turned aside a proposal by Sen. Kelly Ayotte (AY-aht), R-N.H., that would have forced such trials to occur before military tribunals or commissions. The Obama administration has fought to continue bringing such cases in federal courts, with Defense Secretary Leon Panetta and Attorney General Eric Holder writing Senate leaders on Thursday that the measure would deprive them of a potent weapon against terrorism and increase the risk of terrorists escaping justice.

Obama has had numerous clashes with Congress over the handling of war on terror detainees. Congress has voted to prevent the transfer of detainees from the naval prison at Guantanamo Bay, Cuba, to the U.S. Obama has sought to close that detention facility but has been opposed by Republicans and some Democratic lawmakers.

Ayotte said it would be dangerous to let terrorists exercise the protections against self-incrimination and other rights of civilian courts that they might use to avoid surrendering critical information to investigators. Republicans cited last November's acquittal by a federal jury in New York of all but one of hundreds of charges brought against Ahmed Ghailani for his role in destroying two U.S. embassies in Africa, in which 224 people were killed.

"Enemy combatants are not common criminals who just robbed the liquor store," she said, adding, "The priority has to be on gathering information to protect Americans."

Democrats said since the terrorist attacks of Sept. 11 10 years ago, 300 terrorist cases have been successfully prosecuted in federal courts, compared to just three before military commissions. They also pointed to last week's guilty plea in a federal court in Detroit by Umar Farouk Abdulmutallab for trying to destroy a jetliner with a bomb in his underwear and the FBI's successful interrogation of Abdulmutallab.

"Give the president the power he needs to keep America safe," said Sen. Richard Durbin, D-Ill.

Ayotte fell well short of the 60 votes she needed for her amendment to prevail. The vote came as the Senate debated deep into the night over a wide-ranging spending bill that it will not complete until it returns next month after a one-week recess. .