The accident occurred just past midnight at the train station in the village of Bred.
“He had been in Odense with some friends. When they came to Bred, they got out and went toward the station where there is a little decline where you can cross the tracks. The other boys made it across the tracks while the light was green but when the 17-year-old approached, it turned red,” police spokesman Søren Frederiksen told news agency Ritzau.
Frederiksen said that the boy's friends warned him not to try to cross the tracks.
“They yelled that he should stay there but for unknown reasons he crossed and was hit,” he said.
By the time police reached the scene, the teenager was dead. According to Frederiksen, alcohol is not suspected of playing a significant role in the accident.
“We consider this to be a tragic accident,” he said.
The boy's friends were offered crisis counselling as were a number of other people who witnessed the fatal incident.
Frederiksen added that technicians had investigated the railroad crossing lights and did not find anything out of the ordinary.