|The controversial 'don't ask, don't tell' policy has operated for 17 years [EPA]
The US Senate has voted to end a ban on openly gay people serving in the US military, giving Barack Obama, the chance to fulfill a campaign promise to repeal the so-called "don't ask, don't tell" policy.
The landmark vote passed 65-31 in the Senate on Saturday, soon after breaking through a Republican procedural roadblock which had held up the White House-backed legislation.
Obama is expected to sign it into law next week.
The legislation says the president and his top military advisers must certify that lifting the ban will not hurt troops' fighting ability. After that, there is a 60-day waiting period for the military.
More than 13,500 service members have been dismissed under the 1993 'don't ask, don't tell' law that forced gay men and women in the military to hide their sexual identity.
Repeal of the 17-year policy means that, for the first time in American history, gays will be openly accepted by the military and could acknowledge their sexual orientation without fear of being kicked out.
Nick Spicer, Al Jazeera's correspondent in Washington, said: "The 'don't ask, don't tell' law came about under the [Bill] Clinton administration as a compromise ... between allowing [gays] to serve and not allowing them to serve.
"Now the Senate has put an end to what has been - for many serving men and serving women in America's armed forces - a very painful dilemma."
The repeal vote was secured after six Republican senators broke with their party on the earlier procedural vote to let the bill move ahead.
The win is a political triumph for congressional Democrats who struggled in the final hours of the post-election session to overcome Republican objections on several legislative priorities before Republicans regain control of the House in January.
"As Barry Goldwater said, 'You don't have to be straight to shoot straight," said Harry Reid, the Senate majority leader, referring to the late Republican senator from Arizona.
John McCain, a Republican senator and Obama's Republican rival in the 2008 election, led the opposition.
He acknowledged he did not have the votes to stop the bill and he blamed elite liberals with no military experience for pushing their social agenda on troops during wartime.
"They will do what is asked of them,'' McCain said of service members." But don't think there won't be a great cost.
Ahead of the vote Obama said in a statement: "By ending 'don't ask, don't tell,' no longer will our nation be denied the service of thousands of patriotic Americans forced to leave the military, despite years of exemplary performance, because they happen to be gay.
"And no longer will many thousands more be asked to live a lie in order to serve the country they love."
Source: Al Jazeera and agencies