VANCOUVER, British Columbia — Canada’s grand obsession, hockey, led to great national embarrassment when the defeat of the Vancouver Canucks set off one of the country’s worst episodes of rioting in recent decades.

Shortly before the crushing end of the final game of the Stanley Cup playoffs Wednesday night, with the home team trailing the Boston Bruins, 4-0, angry fans embarked on a four-hour rampage through the heart of the city, setting cars ablaze, attacking firefighters, looting and burning stores, and forcing frightened department store employees to take refuge in bathrooms for hours.

On Thursday, while workers replaced windows and covered storefronts in plywood and hundreds of volunteers picked up debris, a nation that takes pride in its reputation for peaceful coexistence wrestled with questions about possible flaws in the national character.

Some feared that the good will that Vancouver had created with its successful hosting of the Winter Olympic Games last year had been lost. Many wondered why the police, who had successfully kept larger crowds under control despite some tense moments during the Olympics, had lost control so badly this time.