Pioneers of racial tolerance in sports, the Boston Bruins in 1958 became the first National Hockey League team to sign an African-American player, making Willie O’Ree the Jackie Robinson of hockey.

Yet they found themselves Thursday addressing hateful racist commentary circulated by Bruins fans and others on social media after Joel Ward, a black forward for the Washington Capitals, scored the winning goal in overtime of Game 7 in the first round of the Stanley Cup playoffs Wednesday at TD Garden.

In an episode that has renewed the conversation about racism in sports and society, the Bruins had barely finished shaking Ward’s hand and saluting their fans from the Garden ice after the game when Ward was targeted with scores of racist posts on Twitter.

The Bruins, Capitals, and NHL immediately condemned the commentary, but the damage was done, as media outlets across the country once again raised questions about Boston’s turbulent racial history, although it was unclear how many of the comments actually came from Boston.

“This kind of emotional and ugly response to a very unfortunate loss rekindles the discussion about what we need to go through, healing the racial divide in America,’’ said Harvard Law professor Charles Ogletree, director of the school’s institute for race and justice. “If we don’t deal with this, we’re going to have a hard time moving forward.’’

‘Just because one ignorant person made this comment to me, I’m not going to judge every Bruins fan the same way.’

Anson Carter, former Bruins player

But Anson Carter, who is black and played for the Bruins from 1996 to 2000, was less forgiving after he also came under attack. When Carter tweeted, “Warrrrrrrrrrrdo!!’’ immediately after the winning goal, a Bruins fan directed a vulgar, racially charged tweet at him, prompting Carter to track down the tweeter and file a complaint with his school, Eastern Connecticut State University.

Carter said he was shocked by the episode, particularly because he recalls only fond memories of Boston.

“When I was traded there, my parents were worried,’’ he recalled. “I remember them saying, ‘Are you sure you’re going to be OK? Shouldn’t you get out of there?’ But my experience in Boston was awesome. Everyone was tremendous.’’

Then came Wednesday’s tweet. On Thursday, Carter heard from Eastern Connecticut’s vice president of student affairs, then received an apology from the tweeter.

“I told him, ‘Don’t think you can hide behind your computer and say that to someone,’ ’’ Carter said. “Don’t act a certain way just because you can’t see my face, because you wouldn’t say that to me in person.’’

The entire episode, Carter said, is “a reminder that racism still exists.’’

“It’s a learned behavior that may take generations to overcome,’’ he said. “But just because one ignorant person made this comment to me, I’m not going to judge every Bruins fan the same way.’’

In some ways, Boston’s national reputation is still tainted by the city’s racial unrest of the 1970s, when court-ordered school desegregation pitted white and black communities against one another. The most memorable images include a group of whites, including a man wielding an American flag, attacking a young black lawyer, Ted Landsmark, on City Hall Plaza and a group of blacks fatally stoning and beating a white auto mechanic, Richard Poleet, after pulling him from his car at a red light in Roxbury.

AP/File

The Bruins made Willie O’Ree the Jackie Robinson of hockey when they made him the NHL’s first black player in 1958.

O’Ree’s early days in the NHL were rife with racism, recalls Bryant McBride, who became the highest ranking black executive in the NHL as vice president of business development in the 1990s. He hired O’Ree to help the league diversify the game and became a close friend.

“Without getting into all the gory details, Willie told me stories about the racially motivated things that happened to him when he began playing in the NHL,’’ McBride said. “He heard racist comments on the ice, and he told me about needing police protection to get in and out of buildings.’’

McBride said he considered those incidents part of the painful legacy of pursuing racial equality in sports.

“I used to categorize those things as products of days gone by,’’ he said. “Now I’m thinking, maybe those days aren’t gone.’’

O’Ree, who is now 76 and lives in California, declined through an NHL spokesman to be interviewed.

More than two dozen players of color appeared this season on NHL rosters, thanks in part to O’Ree’s work with the league.

In Ward’s case, he was born to a working-class couple in Toronto - his parents immigrated to Canada from Barbados - and played many years of junior and minor league hockey, as well as four years at the University of Prince Edward Island, before he reached the NHL in 2006. His series-winning goal was his first of the playoffs.

The racist Twitter comments directed at Ward were reminiscent of an incident in September, when a spectator in London, Ontario, threw a banana at Philadelphia Flyers forward Wayne Simmonds, who is black.

In the latest episode, the hateful tweets became so rampant that even Aaron Ward, a former Bruins defenseman who is white, came under fire. He said two of his Twitter followers, believing he was Joel Ward, attacked him in angry tweets that included the “N bomb.’’

Ward said he replied to each by writing, “Not only are you ignorant and classless, but you’re also an idiot.’’

The Bruins struck a similar theme in their official response to the ugliness. In a statement, the organization said, “The Bruins are very disappointed by the racist comments that were made following the game last night. These classless, ignorant views are in no way a reflection of anyone associated with the Bruins organization.’’

The NHL decried the comments as “ignorant and unacceptable’’ and said the individuals responsible “have no place associating themselves with our game.’’

In Washington, Capitals owner Ted Leonsis said: “What these people have said and done is unforgivable. I hope they are now publicly identified and pay a huge price for their beliefs.’’

Many of the offensive Twitter pages were removed Thursday. Executives at Twitter did not respond to a request for comment. The company’s official rules prohibit the use of obscene or pornographic images but do not explicitly forbid racist commentary.

Ward’s triumphant goal was especially crushing for Bruins fans who expected the team to fare better in defending their Stanley Cup title. Goalie Tim Thomas graciously tapped Ward on the chest in the handshake line and was seen encouraging fans to smile before he left the ice - a sharp contrast to the Bruins loyalists who resorted to digital hate speech.

“It shows us that racism is alive and well, and that we need to spend a lot more time talking about diversity and inclusion,’’ said Dan Lebowitz, executive director of the Center for Sport in Society at Northeastern University.

The most heartening news, said William Smith, founding director of the National Center for Race Amity at Wheelock College, was the number of Twitter users who expressed support for Ward since the initial burst of racism.