The Montreal Canadiens reached one million Twitter followers on Tuesday and decided to thank their fans, but ended up creating a public relations snafu instead.

Nous avons atteint le million d'abonnés! / We've reached 1,000,000 Twitter followers! <a href="https://twitter.com/hashtag/GoHabsGo?src=hash">#GoHabsGo</a> <a href="https://twitter.com/hashtag/CanadiensMTL1M?src=hash">#CanadiensMTL1M</a> <a href="https://t.co/ecIPuHBbpr">pic.twitter.com/ecIPuHBbpr</a> —@CanadiensMTL

The @CanadiensMTL feed was programmed to thank followers with videos and messages.

Videos of different team members were sent randomly to followers

<a href="https://twitter.com/JennifarDumouli">@JennifarDumouli</a> Un message spécial de P.K. / A special message from P.K. <a href="https://twitter.com/hashtag/CanadiensMTL1M?src=hash">#CanadiensMTL1M</a> <a href="https://t.co/yIOIYQgSkv">https://t.co/yIOIYQgSkv</a> —@CanadiensMTL

Some people used the opportunity to criticize the team — and its coach

Others created offensive Twitter handles, or used racist, sexist and obscene language. Many of the tweets were later deleted.

The Montreal Canadiens realized what had happened and started pulling down their own automated messages as well.

Team tweeted an apology

Automated messages were sent from our account tonight resulting from a filtering issue in our campaign to thank our 1M Twitter followers. —@CanadiensMTL

We apologize for the offensive messages and have fixed the issue so it won't happen in the future. —@CanadiensMTL

The Canadiens aren't the first NHL team to have a Twitter campaign hijacked.

In 2014, the Pittsburgh Penguins' #AskNeil hashtag was co-opted by fans who wanted to know about James Neal's history of causing head injuries.

In 2013, the Toronto Maple Leafs used #SEAofBLUE for fans to tweet their support and see those messages on the website's main page. Fans soon noticed tweets were sent to the homepage unfiltered and used #SEAofBLUE to ridicule the team.