Boston Mayor Thomas M. Menino today endorsed fellow Democrat Elizabeth Warren in her challenge to Senator Scott Brown, a Republican for whom the mayor has shown a personal affinity.

Appearing together at a major rally in Roslindale, the mayor said he had withheld his endorsement of Warren until he got to know the first-time political candidate better.

But in a statement announcing the endorsement, he didn’t hold back, making a personal pitch for the Harvard Law School professor and consumer advocate.

“Like many voters, I wanted to get to know Elizabeth Warren,’’ said Menino. “You know how I made up my mind about this election? I thought to myself. What if I wasn’t the mayor. What if I was just a guy from Hyde Park who had a job with the city. Whose wife was an accountant and worried about their retirement savings. What if I was any guy who wondered how his two kids would send his six grandkids to college. And whether they would have good jobs on the other end. If I wasn’t the mayor, who would speak up in Washington on my behalf?’’


The mayor added: “I thought to myself, if I was any guy from Hyde Park, Elizabeth would have my back, and so I have hers.’’

In response, Warren said she was “deeply honored’’ to have Menino’s backing. It should unleash a contingent of political supporters to work on her behalf in the state’s largest city.

That, in turn, would dovetail with the Democratic strategy of running up large vote totals in urban areas to offset any support for Brown in more conservative suburbs and bedroom communities.

“Tom Menino has long been one of the most powerful voices for working families here in the Commonwealth and throughout the country,’’ Warren said in the statement. “I am proud to stand with Mayor Menino, and I look forward to working together on this campaign and in our efforts to fight for a level playing field for hardworking men and women here in Boston and across Massachusetts.’’