An eight-year-old boy has died after he was hit in the head by a puck that flew into the stands at an ice hockey game.

The accident occurred some three minutes before the end of the match in Dunkirk, in northern France, on Saturday evening.

It happened when a player hit the puck - a rubber disk - towards the end of the rink and a teammate then diverted it, sending it into the stands.

The boy named Hugo was at the game with his father.

He was hit near his ear and suffered cardiac arrest.

Rescue workers at the game were able to revive him, but he died on Sunday of his injuries in hospital.

A puck weighs about 170 grams and can travel at more than 180 kilometres per hour when hit during a hockey match.

Dunkirk mayor Patrice Vergriete said the tragedy had hit the close-knit community hard.

"It's hard. Everyone knows each other, everyone knows the kid," Mr Vergriete said.

On Sunday afternoon about 400 people gathered in front of the ice skating rink to lay flowers.

A probe has been opened to determine why the accident happened.

Mr Vergriete said the rink was built to the required standards.

This type of accident is extremely rare but has happened several times in north America.

The latest occurred in 2002 when Brittanie Cecil, 13, was killed when a puck was deflected into the stands in Ohio.

AFP