The US Congress has moved a step closer to overturning the controversial "don't ask, don't tell" policy on openly gay people serving in the military.
Visitors cheered as the House of Representatives approved measures to change the 1993 law, in an amendment to a defence spending bill.
The vote came hours after the Armed Services Committee in the Senate also approved the change.
The plan now has to be passed by the full Senate before it can become law.
The repeal of the policy would be a major victory for gay rights activists and for President Barack Obama, who has championed the move.
The House of Representatives voted 234-194 in favour of changing the law that currently allows gay people to serve in the military only if they hide their sexual orientation.
Democratic House Speaker Nancy Pelosi said: "We honour the values of our nation and we close the door on a fundamental unfairness."
"Lawmakers today stood on the right side of history," said Joe Solmonese, of the gay rights group Human Rights Campaign.
Mr Obama said the move would make the military "stronger and more inclusive".
Many Republicans voted against the amendment, saying Congress should postpone the vote until a Pentagon review of the impact of the measure on the armed forces is completed at the end of the year.
The chiefs of the army, navy, air force and marines have also objected on the same grounds.
Republican Senator John McCain, a Vietnam veteran, said: "It's going to be very harmful to the morale and affect the battle effectiveness of our military."
The amendment stipulates that the repeal will not be implemented until after the Pentagon review is completed.
It also says the repeal will not become law until the president, defence secretary and the Joint Chiefs of Staff certify that it will not have a negative impact on the military's effectiveness.
Defence Secretary Robert Gates, who has stated his support for allowing gays openly to serve, said on Tuesday he would have preferred that Congress had waited until after the Pentagon's review.
The amendment is attached to a spending bill which comes up for a final vote in the House on Friday.
While the bill enjoys wide support, some lawmakers have vowed to vote against it if it includes the amendment to repeal the ban.
If it passes that hurdle, the bill will then face a full Senate vote next month.