Barack Obama has abandoned a commitment to veto a new security law that allows the military to indefinitely detain without trial American terrorism suspects arrested on US soil who could then be shipped to Guantánamo Bay.

Human rights groups accused the president of deserting his principles and disregarding the long-established principle that the military is not used in domestic policing. The legislation has also been strongly criticised by libertarians on the right angered at the stripping of individual rights for the duration of "a war that appears to have no end".

The law, contained in the defence authorisation bill that funds the US military, effectively extends the battlefield in the "war on terror" to the US and applies the established principle that combatants in any war are subject to military detention.

The legislation's supporters in Congress say it simply codifies existing practice, such as the indefinite detention of alleged terrorists at Guantánamo Bay. But the law's critics describe it as a draconian piece of legislation that extends the reach of detention without trial to include US citizens arrested in their own country.

"It's something so radical that it would have been considered crazy had it been pushed by the Bush administration," said Tom Malinowski of Human Rights Watch. "It establishes precisely the kind of system that the United States has consistently urged other countries not to adopt. At a time when the United States is urging Egypt, for example, to scrap its emergency law and military courts, this is not consistent."

There was heated debate in both houses of Congress on the legislation, requiring that suspects with links to Islamist foreign terrorist organisations arrested in the US, who were previously held by the FBI or other civilian law enforcement agencies, now be handed to the military and held indefinitely without trial.

The law applies to anyone "who was a part of or substantially supported al-Qaida, the Taliban or associated forces".

Senator Lindsey Graham said the extraordinary measures were necessary because terrorism suspects were wholly different to regular criminals.

"We're facing an enemy, not a common criminal organisation, who will do anything and everything possible to destroy our way of life," he said. "When you join al-Qaida you haven't joined the mafia, you haven't joined a gang. You've joined people who are bent on our destruction and who are a military threat."

Graham added that it was right that Americans should be subject to the detention law as well as foreigners. "It is not unfair to make an American citizen account for the fact that they decided to help Al Qaeda to kill us all and hold them as long as it takes to find intelligence about what may be coming next," he said. "And when they say, 'I want my lawyer,' you tell them, 'Shut up. You don't get a lawyer.'"

Other senators supported the new powers on the grounds that al-Qaida was fighting a war inside the US and that its followers should be treated as combatants, not civilians with constitutional protections.

But another conservative senator, Rand Paul, a strong libertarian, has said "detaining citizens without a court trial is not American" and that if the law passes "the terrorists have won".

"We're talking about American citizens who can be taken from the United States and sent to a camp at Guantánamo Bay and held indefinitely. It puts every single citizen American at risk," he said. "Really, what security does this indefinite detention of Americans give us? The first and flawed premise, both here and in the badly named Patriot Act, is that our pre-9/11 police powers were insufficient to stop terrorism. This is simply not borne out by the facts."

Paul was backed by Senator Dianne Feinstein.

"Congress is essentially authorising the indefinite imprisonment of American citizens, without charge," she said. "We are not a nation that locks up its citizens without charge."

Paul said there were already strong laws against support for terrorist groups. He noted that the definition of a terrorism suspect under existing legislation was so broad that millions of Americans could fall within it.

"There are laws on the books now that characterise who might be a terrorist: someone missing fingers on their hands is a suspect according to the department of justice. Someone who has guns, someone who has ammunition that is weatherproofed, someone who has more than seven days of food in their house can be considered a potential terrorist," Paul said. "If you are suspected because of these activities, do you want the government to have the ability to send you to Guantánamo Bay for indefinite detention?"

Under the legislation suspects can be held without trial "until the end of hostilities". They will have the right to appear once a year before a committee that will decide if the detention will continue.

The Senate is expected to give final approval to the bill before the end of the week. It will then go to the president, who previously said he would block the legislation not on moral grounds but because it would "cause confusion" in the intelligence community and encroached on his own powers.

But on Wednesday the White House said Obama had lifted the threat of a veto after changes to the law giving the president greater discretion to prevent individuals from being handed to the military.

Critics accused the president of caving in again to pressure from some Republicans on a counter-terrorism issue for fear of being painted in next year's election campaign as weak and of failing to defend America.

Human Rights Watch said that by signing the bill Obama would go down in history as the president who enshrined indefinite detention without trial in US law.

"The paradigm of the war on terror has advanced so far in people's minds that this has to appear more normal than it actually is," Malinowski said. "It wasn't asked for by any of the agencies on the frontlines in the fight against terrorism in the United States. It breaks with over 200 years of tradition in America against using the military in domestic affairs."

In fact, the heads of several security agencies, including the FBI, CIA, the director of national intelligence and the attorney general objected to the legislation. The Pentagon also said it was against the bill.

The FBI director, Robert Mueller, said he feared the law could compromise the bureau's ability to investigate terrorism because it would be more complicated to win co-operation from suspects held by the military.

"The possibility looms that we will lose opportunities to obtain co-operation from the persons in the past that we've been fairly successful in gaining," he told Congress.

Civil liberties groups say the FBI and federal courts have dealt with more than 400 alleged terrorism cases, including the successful prosecutions of Richard Reid, the "shoe bomber", Umar Farouk, the "underwear bomber", and Faisal Shahzad, the "Times Square bomber".

Elements of the law are so legally confusing, as well as being constitutionally questionable, that any detentions are almost certain to be challenged all the way to the supreme court.

Malinowski said "vague language" was deliberately included in the bill in order to get it passed. "The very lack of clarity is itself a problem. If people are confused about what it means, if people disagree about what it means, that in and of itself makes it bad law," he said.