WASHINGTON — Senator Scott Brown said yesterday that he supports repealing the military’s “don’t ask, don’t tell’’ policy, even as top Army and Marine generals broke with their Pentagon superiors and warned that letting gays serve openly during wartime would be disruptive and could divide the troops.

Brown’s long-awaited decision was welcomed by those who hope Congress will soon change the controversial 17-year-old policy but was scorned by some “don’t ask’’ backers.

Passage of a repeal hinges on a handful of undecided senators. Democrats have a limited amount of time to bring up the issue in the lame-duck session, and Republican opponents may try to run out the clock.

The next few weeks represent advocates’ best shot for a reversal. If Congress doesn’t take action, the measure would be much harder to pass next year, when Republicans take control of the House and Democrats have fewer votes in the Sen ate.

Brown, after listening to two days of hearings before the Senate Armed Services Committee, said he felt comfortable that top military brass would carry out a new policy in a way that did not hinder wartime efforts.

“I have visited our injured troops at Walter Reed and have attended funerals of our fallen heroes,’’ he said in a statement. “When a soldier answers the call to serve, and risks life or limb, it has never mattered to me whether they are gay or straight. My only concern has been whether their service and sacrifice is with pride and honor.’’

He also said he felt comfortable that Secretary of Defense Robert Gates would adopt a repeal only “when the battle effectiveness of the forces is assured and proper preparations have been completed.’’

Gates, along with Admiral Mike Mullen, chairman of the Joint Chiefs of Staff, pressed Congress on Thursday to repeal the ban, saying the military was ready and wartime would be no hindrance. But yesterday, several generals testified otherwise, warning the committee that now was not the time.

“I would not recommend going forward at this time, given everything that the Army has on its plate,’’ General George Casey, the Army chief of staff, told the Senate committee.

Brown and Senator Susan Collins of Maine are the only Republicans who have come out in support of repealing the policy. Several other Republicans — including Mark Kirk of Illinois and Olympia Snowe of Maine — have not said whether they would vote for a repeal. A few Democrats, including Senator Jim Webb of Virginia and Senator-elect Joe Manchin of West Virginia, also have not said whether they would support repeal.