The US House of Representatives passed legislation to freeze some Pakistan aid, slap harsh new sanctions on Iran, and endorse indefinite imprisonment of suspected terrorists.
Acting shortly after the White House dropped a threat to veto the bill, the Republican-led chamber voted 283-136 to approve the $662 billion Defense Authorization bill, which also sets high hurdles for closing Guantanamo Bay.
The Democratic-held Senate was expected to vote on the same bill as early as Thursday.
The measure had drawn fire from civil liberties groups that denounced its de facto embrace of holding alleged extremists without charge until the end of the "war on terrorism" declared after the September 11, 2001 attacks.
US President Barack Obama, who had threatened to veto earlier versions of the yearly measure, will sign it when it reaches his desk despite lingering misgivings, spokesman Jay Carney said in a statement before the vote.
"However, if in the process of implementing this law we determine that it will negatively impact our counterterrorism professionals and undercut our commitment to the rule of law, we expect that the authors of these provisions will work quickly and tirelessly to correct these problems," said Carney.
The legislation, a compromise blend of rival House and Senate versions, requires that Al-Qaeda fighters who plot or carry out attacks on US targets be held in military, not civilian, custody, subject to a presidential waiver.
The bill exempts US citizens from that fate, but leaves it to the US Supreme Court or future presidents to decide whether US nationals who sign on with Al-Qaeda or affiliated groups may be held indefinitely without trial.
"In the past, Obama has lauded the importance of being on the right side of history, but today he is definitely on the wrong side," said Kenneth Roth, executive director of Human Rights Watch.
Obama had warned he could reject the original proposal over the military custody issue, as well as provisions he charged would short-circuit civilian trials for alleged terrorists.
Signup to our newsletter and follow us on Facebook and Twitter!
FBI Director Robert Mueller warned lawmakers Wednesday that he still had "concerns" that the legislation left unclear "what happens at the time of arrest" in terms of detaining or questioning a suspect in a terrorism case.
There is a risk that "we will lose opportunities to obtain cooperation from the persons that, in the past, we've been fairly successful in gaining," he told the Senate Judiciary Committee.
And "this statute that gives the military an inroad to making detentions in the United States may be applicable and work well with the persons you have now -- but five years, 10 years down the road, what could this mean?" he said.
The lawmakers crafting the compromise measure strengthened Obama's ability to waive parts of the detainee provisions, and reaffirmed that the custody rules would not hamper ongoing criminal investigations by the FBI or other agencies.
And they slightly diluted the legislation's tough new sanctions on Iran, which aim to cut off Tehran's central bank from the global financial system in a bid to force the Islamic republic to freeze its suspect nuclear program.
The goal of the legislation is to force financial institutions to choose between doing business with the central bank -- Iran's conduit for selling its oil to earn much-needed foreign cash -- or doing business with US banks.
The bill would also freeze roughly $700 million in aid to Pakistan pending assurances that Islamabad has taken steps to thwart militants who use improvised explosive devices (IEDs) against US-led forces in Afghanistan.
"If this legislation becomes law, we'll work with the government of Pakistan on how we can fulfill the requirements. But, this requires us to maintain a strategic perspective," US State Department spokeswoman Victoria Nuland said.
The measure forbids the transfer of Guantanamo Bay detainees to US soil and sharply restricts moving such prisoners to third countries -- steps that critics of the facility say will make it much harder to close down.
The legislation also calls for closer military ties with Georgia, including the sale of weapons that supporters say would help the country, which fought a brief war with Russia in 2008, defend itself.
It also included a measure to crack down on counterfeit electronics making their way from China into the Pentagon's supply chain, hurting the reliability of high-priced US weapons programs.
Among Republicans, 190 voted yes and 43 voted no, while Democrats were evenly split with 93 votes each way.