The US Senate has passed controversial legislation endorsing President George W Bush's proposals to interrogate and prosecute foreign terror suspects.

The 65-34 vote followed Thursday's backing by the House of Representatives for almost identical legislation.

The new bill could be signed into law by the president within a few days.

Under the new legislation, special tribunals will be set up to question and try suspects being held at Guantanamo Bay, Cuba.

"As our troops risk their lives to fight terrorism, this bill will ensure they are prepared to defeat today's enemies and address tomorrow's threats," President Bush said in a statement on Thursday.

Mr Bush had to compromise to get it past his own party but the guts of what he wanted are all there, says the BBC's Justin Webb.

In the run up to the mid-term elections he is now free to trumpet his party's tough approach and accuse the Democrats of coddling the terrorists, our correspondent says.

But human rights activists have expressed concern that the new tribunals might not give the same protection to suspects as the existing civil courts.

Legal standards

The legislation is a response to a Supreme Court ruling in June that the original military tribunals set up by the Bush administration to prosecute detainees were in violation of US and international law.

The new measures provide defendants with more legal rights than they had under the old system but eliminate their right to challenge their detention and treatment in federal courts.

This longstanding tradition of our country about to be abandoned here is one of the great, great mistakes that I think history will record

The bill forbids treatment of detainees that would constitute war crimes - such as torture, rape and biological experiments - but gives the president the authority to decide which other techniques interrogators can use.

However, during a heated debate, Democrat senators accused the administration of tearing up 200 years of legal standards by removing detainees rights such as habeas corpus - the right to challenge their own detention.

"This longstanding tradition of our country about to be abandoned here is one of the great, great mistakes that I think history will record," Democrat Chris Dodd told the Senate.

Others backed claims by human rights groups that worry that the complex set of rules will allow harsh techniques that border on torture - such as sleep deprivation.

"This bill gives an administration that lobbied for torture exactly what it wanted," said Senator John Kerry.

A US army reserve office and lawyer representing a Yemeni detainee in Guantanamo Bay, Tom Fleener, criticised the loss of some rights, such as habeas corpus, to secure others, such as a detainee's right to see evidence.

He said the legislation was "horrific" and that "anything short of torture" could be admitted against such detainees.

McCain backing

Republican Senator Kit Bond responded by accusing the Democrats of being soft on terrorism.

"Now some want to tie the hands of our terror fighters," he said. "They want to take away the tools we use to fight terror. To handcuff us. To hamper us in our fight to protect our families."

And Republican Senator John McCain, a former prisoner-of-war who had been critical of the Bush administration's earlier policy on foreign terror suspects, welcomed the bill's passage.

"I think what you'll see now after the president signs this bill is convening of tribunals to address these cases which are long overdue; a bolstering of the Geneva Conventions because of our renewed commitment to it; and I am convinced that because of this legislation certain, quote, techniques, unquote, such as water boarding, prolonged stress positions, long, extreme sleep deprivation, will not be allowed."

As a result of the Senate vote, the military tribunals could resume under the new guidelines in early 2007.

But there is the possibility that this new legislation could also be challenged in the Supreme Court.