WASHINGTON — The US Senate passed a $662 billion defense bill Thursday that also freezes some Pakistan aid, imposes sanctions on Iran's central bank, and approves the indefinite imprisonment of suspected terrorists.

The Democrat-led Senate voted 86-13 for the Defense Authorization bill, which was passed Wednesday by the House. President Barack Obama was expected to sign it as early as this weekend after dropping a veto threat.

The measure, which also sets high hurdles for closing Guantanamo Bay, had drawn fire from civil liberties groups that strongly criticized its de facto embrace of holding alleged extremists without charge until the end of the "war on terrorism," which was declared after the September 11, 2001 attacks.

Obama, who had threatened to veto earlier versions of the yearly measure, will sign it despite lingering misgivings, his spokesman Jay Carney said before the House vote on Wednesday.

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.

The bill also freezes 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.

Earlier Thursday, Pakistan angrily criticized US moves to freeze the aid money -- the latest rifts in a fraying alliance that has been in deep crisis since air strikes by US-led forces killed 24 Pakistani soldiers last month.

"We believe that the move in the US Congress is not based on facts and takes a narrow vision of the overall situation; hence, wrong conclusions are unavoidable," said foreign ministry spokesman Abdul Basit.

The legislation also brings tough new sanctions to Iran, with the 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 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 legislation meanwhile 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 an amendment ensuring the United States would not hand over sensitive information to Moscow on the US missile defense system, a measure to win over hold-out senators who have been blocking the pending nomination Michael McFaul as US ambassador to Russia.

After Obama lifted his veto threat, rights groups chastised the US leader for his changing stance on holding prisoners without trial.

"It is a sad moment when a president who has prided himself on his knowledge of and belief in constitutional principles succumbs to the politics of the moment to sign a bill that poses so great a threat to basic constitutional rights," said Kenneth Roth, executive director of Human Rights Watch.

"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," Roth said.

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.

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.

The measure meanwhile 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 bill passed by a wide margin, with only six Democrats and six Republicans voting against the legislation, along with the lone Independent of the chamber, Bernie Sanders of Vermont.