Walczak has been close friends with John Barros, a former School Committee member who led the Dudley Street Neighborhood Initiative, since both went to Africa in 2007 on a trip for advocates rebuilding their communities. In one of the villages they visited, Barros played drums while Walczak played the guitar.

Charles Yancey, Mike Ross, Rob Consalvo, Felix Arroyo, and John Connolly are colleagues on the City Council. Consalvo said he considers Connolly and Ross among his friends.

Suffolk District Attorney Daniel F. Conley has worked with Walsh on a range of initiatives, including the creation of a witness protection program and fund. He served on the council with Mike Ross and often bumped into Charlotte Golar Richie, a former city housing chief, at City Hall.

“Many of us have worked together in the past, so we are colleagues,’’ said Golar Richie, who also served in the Legislature with Walsh. “And I also think there is interest in wanting to unite the city, if not during the final days certainly after whoever is elected mayor.’’

With forums held practically every day during the height of the campaign, the candidates have had numerous opportunities to bolster the camaraderie. Even their criticisms of one another are tinged with collegiality.

“I believe the 12 of us really appreciate what each other is trying to do — the long days, time management,’’ Conley said. “We’ve had a long clean fight in the good sense of the word where we talk about issues and ideas, and we don’t let it get into personalities.”

The candidates joke around, dole out compliments, and, once, even challenged each other to a three-on-three basketball game.

They joke around, dole out compliments, and, once, even challenged each other to a three-on-three basketball game to prove their athletic abilities.

“These guys make fun of me because I’m short and I battle my weight,’’ said Consalvo, who regularly plays tennis and basketball. “They look at me and don’t think that I’m an athlete.”

Some of the candidates had been teasing Consalvo after his campaign launched a commercial last month showing him downing 3-pointers without missing. After a “Meet the Candidates” event at a park in Mattapan, Consalvo challenged them to a game. He, Walczak, and Ross played against Arroyo, Barros, and a 15-year-old boy from Mattapan.

The Barros-Arroyo team won 15-8.

“I must say, for the record, as good as I like to play, John Barros was definitely the star,’’ said Consalvo. “And I was impressed with Felix. I had the unfortunate task of guarding John Barros, and he schooled me.”

At a forum at Boston Latin School recently, the candidates went from classroom to classroom making their case for mayor before small groups of students and residents. As Arroyo left one room, he stumbled into Barros.

“Man, I’m after you,’’ Barros said, implying that Arroyo is a tough act to follow.

“And I did it all in Spanish,’’ Arroyo said, as the two men erupted in laughter.

That kind of banter is standard fare in the campaign. It helps to pass the time, puts people at ease, and gets the candidates through long days, the mayoral contenders said.

“Some of us are jokesters,’’ explained Barros. “So we have more fun with each other.”

Arroyo added that in this race, he is keeping things friendly and tries to remain focused on the core issues of his campaign.

“That’s where my focus is,’’ he said. “So my relationship with all the candidates is very cordial. I’ve worked with some of them on the council. I’ve worked with others in the neighborhoods. And frankly, as mayor, I plan to continue working with them.”

After a sometimes testy forum at University of Massachusetts Boston this week, Arroyo grabbed Walsh for a huge congratulatory bear hug.

It is not to say there have not been disagreements.

The candidates have repeatedly faced off on matters that have exposed deep divisions on serious issues, such as whether to raise the cap on charter schools, or who should decide whether a casino is built in the city.

Last week, Ross slammed Walsh for pressing his proposal to sell City Hall, saying it was a stale idea. He has also confronted Walczak, the lone anticasino candidate, arguing that Walczak has no real plan to prevent a casino. But he is also quick to pay the candidates a compliment.

“Felix is a great guy,’’ he said.

The candidates added that Bostonians are tired of the bickering that often takes center stage in political campaigns.

“I think it’s kind of sad that we live in such a violent society where civility has almost disappeared,” said Yancey, the Mattapan city councilor who is running to keep his seat and the mayor’s job.

The candidates said that many who flock to the community forums are interested in hearing answers to their questions rather than candidates slamming one another.

When the campaign started, Walczak had expected that things would get “nasty and edgy,” particularly since Boston has not elected a mayor in 20 years. But that has not happened.

“I’ve had conversations with most of the people in the race and I’ve said ‘we should all get together when this is all over and talk about how it went in the campaign,’ ’’ said Walczak. “I think it would be interesting. It’s a good campaign for Boston.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.