Defense Secretary Robert Gates said Monday he's “not particularly optimistic” that Congress would soon repeal “Don't Ask, Don't Tell,” the 17-year-old law that bans gay and bisexual troops from serving openly, CNN reported.

Gates was among the military leaders who testified before a Congressional panel last week in favor of repeal. Democratic leaders have said they'll bring a defense spending bill that includes the repeal measure to a vote before the end of the year. Republicans, led by Arizona Senator John McCain, have threatened to filibuster the move in the Senate.

“One of the virtues of the legislation that's in front of the Congress right now is that it gives the president and me and the chairman of the Joint Chiefs of Staff latitude in how long we take to prepare for this and how long it actually would be to be implemented,” Gates told told troops serving on the aircraft carrier USS Abraham Lincoln.

“Before a change in the law, we would have to certify that we've made enough preparations that it wouldn't affect unit cohesion, morale, retention and recruiting, and so on,” he added. “The legislation would give us great deal of flexibility. I am not particularly optimistic, though, that it will get done. We'll see.”

In his testimony, Gates urged Congress to repeal the law before courts forced its immediate end. A judge's order that called the law unconstitutional forced the military to end enforcement of the policy for eight days in October. The Obama administration convinced an appeals court to put the ruling on hold as the case is appealed.

“A change in this law is inevitable,” Gates added on Monday.