The US Senate has approved landmark legislation allowing openly gay people to serve in the military.
Senators voted 65-31 to overturn the 1993 "don't ask, don't tell" law, which bars gay people in the military from revealing their sexual orientation.
The House of Representatives had already approved the repeal bill. President Barack Obama says he is looking forward to signing it into law.
Opponents argue that the change will damage troop morale at a time of war.
More than 13,000 service members have been dismissed under the "don't ask, don't tell", policy enacted under President Bill Clinton in 1993 as a compromise.
Saturday's vote was along broad party lines, with a few moderate Republicans joining the Democratic majority in favour of lifting the ban.
The BBC's Iain Mackenzie in Washington says the vote is a major victory for Mr Obama, who had made overturning "don't ask, don't tell" a key policy objective.
The president said it meant "thousands of patriotic Americans" would not be forced to leave the military "because they happen to be gay".
President Obama is expected to sign the bill next week.
The repeal will take effect after a 60-day period allowing the defence department to consider how to implement the new policy.
Defence secretary Robert Gates also welcomed the Senate vote.
"Once this legislation is signed into law by the president, the Department of Defense will immediately proceed with the planning necessary to carry out this change carefully and methodically, but purposefully," he said.
Aubrey Sarvis, head of the Servicemembers Legal Defense Network, an advocacy group, said: "Until the president signs the bill, until there is certification, and until the 60-day Congressional period is over, no-one should be investigated or discharged under this discriminatory law."
Earlier this month, a Pentagon report said that allowing openly gay troops would have little impact on the cohesion of US forces fighting in Iraq and Afghanistan.
The Democrats, who still control both house of Congress, have said they want to approve the repeal before the start of a new Congress in January.