Urging lawmakers to put themselves on "the right side of history," Mayor Michael R. Bloomberg visited the Capitol on Tuesday and vowed to support the re-election campaign of any Republican senator who votes to allow gay couples to wed.

For six hours, the mayor plodded from one office to another in the mazelike legislative office building and the Capitol, across the street, meeting with six rank-and-file Republican senators whom gay rights advocates view as possible supporters of same-sex marriage.

The visit by Mr. Bloomberg, who has been among the biggest donors to Senate Republicans in recent years, came as lawmakers and same-sex marriage advocates begin a monthlong push to muster the small number of Republican votes needed to win approval of same-sex marriage in the Republican-controlled Senate.

"The longer the Senate obstructs marriage equality," the mayor told reporters, "the heavier the price they will pay not only in the history books, but at the polls."

Mr. Bloomberg's urging did not pay immediate dividends, but several senators indicated that they were still on the fence.