WASHINGTON - (AP) - In a landmark for gay rights, the Senate onSaturday voted to let gays serve openly in the military, givingPresident Barack Obama the chance to fulfill a campaign promise andrepeal the 17-year policy known as "don't ask, don't tell."

Obama was expected to sign it next week, although the changewouldn't take immediate effect. The legislation says the presidentand his top military advisers must certify that lifting the banwon't hurt troops' fighting ability. After that, there's a 60-daywaiting period for the military.

"It is time to close this chapter in our history," Obama saidin a statement after a test vote cleared the way for final action."It is time to recognize that sacrifice, valor and integrity areno more defined by sexual orientation than they are by race orgender, religion or creed."

The Senate vote was 65-31. The House had passed an identicalversion of the bill, 250-175, on Wednesday.

Repeal would mean that, for the first time in American history,gays would be openly accepted by the military and could acknowledgetheir sexual orientation without fear of being kicked out.

More than 13,500 service members have been dismissed under the1993 law.

Rounding up a filibuster-proof majority in the Senate was ahistoric victory for Obama, who made repeal a campaign promise in2008. It also was a political triumph for congressional Democratswho struggled in the final hours of the postelection session toovercome GOP objections on several legislative priorities beforeRepublicans regain control of the House in January.

"As Barry Goldwater said, 'You don't have to be straight toshoot straight,"' said Senate Majority Leader Harry Reid, D-Nev.,referring to the late GOP senator from Arizona.

Sen. John McCain, Obama's GOP rival in 2008, led the opposition.The Arizona Republican acknowledged he didn't have the votes tostop the bill and he blamed elite liberals with no militaryexperience for pushing their social agenda on troops duringwartime.

"They will do what is asked of them," McCain said of servicemembers. "But don't think there won't be a great cost."

In the end, six GOP senators broke with their party on theprocedural vote to let the bill move ahead and swung behind repealafter a recent Pentagon study concluded the ban could be liftedwithout hurting the ability of troops to fight.

Advocacy groups who lobbied hard for repeal hailed the vote as asignificant step forward in gay rights. The Servicemembers LegalDefense Network called the issue the "defining civil rightsinitiative of this decade."

Supporters of repeal filled the visitor seats overlooking theSenate floor, ready to protest had the bill failed.

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

The Pentagon study found that two-thirds of service membersdidn't think changing the law would have much of an effect. But ofthose who did predict negative consequences, a majority wereassigned to combat arms units. Nearly 60 percent of the MarineCorps and Army combat units, such as infantry and specialoperations, said in the survey they thought repealing the law wouldhurt their units' ability to fight.

The Pentagon's uniformed chiefs are divided on whether thisresistance might pose serious problems.

Marine Corps Commandant Gen. James Amos has said he thinkslifting the ban during wartime could cost lives.

"I don't want to lose any Marines to the distraction," he toldreporters this week. "I don't want to have any Marines that I'mvisiting at Bethesda (Naval Medical Center) with no legs be theresult of any type of distraction."

Adm. Mike Mullen and Marine Gen. James Cartwright, the chairmanand vice chairman of the Joint Chiefs of Staff, respectively, havesaid the fear of disruption is overblown. They note the Pentagon'sfinding that 92 percent of troops who believe they have served witha gay person saw no effect on their units' morale or effectiveness.Among Marines in combat roles who said they have served alongside agay person, 84 percent said there was no impact.