The 65-31 vote means gays and lesbians will be able to serve openly in the military without punishment after President Obama signs the bill.

Reporting from Washington and Los Angeles — The Senate voted to allow gays and lesbians to serve openly in the military, approving a bill that repeals the policy of "don't ask, don't tell" on Saturday.

The 65-31 vote came after an earlier procedural vote that brought the milestone in gay rights to the Senate floor. It also fulfilled a campaign promise by President Obama, who has been under attack from liberals in his own party for seeking compromises with Republicans on economic and tax issues during the lame-duck congressional session.

The White House said Obama will sign the measure into law next week. Repeal means that gays and lesbians can openly serve without fear of punishment. More than 13,500 people have been dismissed from the military since the 1993 law went into effect.

"The Senate has taken an historic step toward ending a policy that undermines our national security while violating the very ideals that our brave men and women in uniform risk their lives to defend," President Obama said in a prepared 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.

"It is time to close this chapter in our history," he stated. "It is time to recognize that sacrifice, valor and integrity are no more defined by sexual orientation than they are by race or gender, religion or creed. It is time to allow gay and lesbian Americans to serve their country openly. I urge the Senate to send this bill to my desk so that I can sign it into law."

A week ago, the repeal seemed to be politically dead, caught in sparring between Democrats and Republicans. But Democrats moved the repeal from an amendment to a defense bill to a separate measure that passed the House this week 250 to 174. Some of the more liberal Senate Republicans began to shift as well.

In a test earlier Saturday, the Senate voted 63 to 33 for repeal, a large enough outcome to assure final passage after six Republicans joined with Democrats to advance the bill.

The six Republican senators who voted with the majority were: Scott Brown, of Massachusetts; Susan M. Collins and Olympia J. Snowe, both of Maine; Mark Kirk of Illinois; Lisa Murkowski of Alaska and George Voinovich of Ohio. Sen. Joe Manchin, of West Virginia, the only Democrat to oppose repeal, did not vote.

In the final vote, two more Republicans, John Ensign of Nevada and Richard Burr of North Carolina, crossed over.

"Don't ask, don't tell is wrong," Sen. Ron Wyden (D-Ore.) in his opening remarks Saturday morning, sounding a frequent theme during the debate. "I don't care who you love. If you love this country enough to risk your life for it, you shouldn't have to hide who you are. You ought to be able to serve."

Many Republicans, led by Sen. John McCain (R-Ariz.), opposed the repeal, arguing it should not be considered during the current time of war. That position is backed by chiefs of the Army and Marine Corps who have warned Congress that repeal could pose problems if the law is overturned.

Speaking on the floor before the procedural vote, McCain, the GOP's presidential candidate in 2008, acknowledged that Republicans didn't have the vote to block repeal. He derisively noted that liberals, who lacked military experience, would "high five" across America.

McCain and other Republicans argued that the repeal should not be pushed on troops during a time of war. "They will do what is asked of them," McCain said of the military, "but don't think there won't be a great cost."

Republicans also cited questions among some military leaders, particularly, Marine Corps Commandant Gen. James Amos, who argued that repeal could cost lives.

"I don't want to lose any Marines to the distraction," he told reporters this week.

But other military officials including, Adm. Mike Mullen and Marine Gen. James Cartwright, the chairman and vice chairman of the Joint Chiefs of Staff, said the fear of disruption is overblown.

Proponents of the repeal made two basic arguments, one involving civil rights and the other military preparedness.

"This is a historic vote for equality, civil rights and a stronger America," said Sen. Barbara Boxer (D-Calif.). "This is a continuation of our nation's march toward full equality for all."

Democrats also cited a recently released Pentagon study that found that two-thirds of the military didn't think changing the law would have much of an effect.

Once the measure becomes law, Obama and military chiefs will have to certify that the change wouldn't hurt the ability of troops to fight and there would also be a 60-day waiting period. The actual elimination of "don't ask, don't tell," which dates back to the Clinton administration, could take as long as a year.

Still, there was happiness among supporters, some of whom were in the Senate gallery to watch the vote.

"This has been a long fought battle, but this failed and discriminatory law will now be history," said Joe Solmonese, president of the Human Rights Campaign.

The Senate began its rare weekend session Saturday morning poised to battle over two of the most contentious social issues in this lame-duck session, "don't ask, don't tell" and immigration. Earlier, the Senate voted down an effort to bring the Dream Act to the floor.