WASHINGTON — US lawmakers have voted to allow gays to serve openly in the military for the first time, but troops must wait months before they can reveal their sexual orientation without facing dismissal.

Amid concerns over unit cohesion at a time when the United States is still heavily embroiled militarily in Afghanistan and Iraq, senior officials want a deliberate process to ensure the smoothest possible transition.

Several Republicans joined Democrats to repeal "Don't Ask, Don't Tell," a 1993 law enacted under Bill Clinton's administration as a compromise from an outright ban on gays and lesbians serving in the US military.

Saturday's vote, which capped two weeks of bitterly divisive debate, marked for some the biggest shift in the US military since racial integration began in 1948. President Barack Obama, who vowed during his 2008 White House bid to lift the ban, hailed the "historic step."

"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," he added.

When Obama signs the measure into law in the coming days, he will launch a White House and Pentagon certification process that could take up to a year.

Obama, Defense Secretary Robert Gates and Chairman of the Joint Chiefs of Staff Michael Mullen must now certify that lifting the ban can be done without harming military readiness, effectiveness, unit cohesion, and recruitment.

Gates said the Pentagon would "immediately proceed with the planning necessary to carry out this change carefully and methodically, but purposefully."

A Pentagon study issued this month found a clear majority of troops were not bothered by the prospect of lifting the ban and that the military could implement the change without major disruption or upheaval.

It said military leaders would have to dust off the the military code of justice, unit commanders would remind their troops of professional values and the 3,000 military chaplains would address moral and religious concerns.

After this preparation phase, the new rules would still not take effect for another 60 days.

The military will implement change in a "responsible, deliberate manner," said Mullen, the highest ranking military officer.

Gates warned troops they should keep their sexual orientation quiet for now because the current law and policy will remain in effect during the deliberative process.

The Pentagon has nonetheless implemented a de facto moratorium on ousting troops over their sexual orientation since a first ruling against "Don't Ask, Don't Tell" by a federal judge in October.

Human Rights Campaign, a gay rights group, called on Obama and Gates to "act expeditiously to complete the steps necessary to implement final repeal."

In the years since the ban was enacted as a compromise, some 13,000 US troops have been ousted, and critics have pointed out that many were trained at great expense, like fighter pilots, or had hard-to-find skills, such as Arabic translators.

But opponents of the legislation have cited testimony from US military service chiefs who warned against a quick repeal due to concerns about unit cohesion.

"It isn't broke, don't fix it," said Senator John McCain, the top Republican on the Senate Armed Services Committee who lost his 2008 White House bid to Obama and has been a fierce foe of lifting the ban.

"To somehow allege that it has harmed our military is not justified by the facts.... Don't think that it won't be at great cost."

General James Amos, commandant of the Marine Corps and an opponent of lifting the ban, had warned that repeal could jeopardize the lives of Marines in combat by undermining closely knit units.

But repeal enjoyed broad support from the US public, as well as from Gates, who had urged lawmakers to act swiftly in order to avoid a court-ordered solution -- and Mullen, who said ending the ban was "the right thing to do."