BEIJING — For decades, the “Five Heroes of Langya Mountain” have been presented as courageous examples of how the Communist-led Eighth Route Army fought for the Chinese people against the Japanese invaders in World War II.

The tale of how the five men fended off Japanese troops atop a mountain peak in Hebei Province, choosing to smash their weapons and leap — three of them to their deaths — rather than surrender, has been memorialized in museums, school textbooks, paintings, plays and movies. They were celebrated across China until a historian, Hong Zhenkuai, challenged the official narrative in two articles published three years ago.

But his questioning of what actually happened in 1941 landed him in a lawsuit, and on Monday, a court in Beijing ruled against him.

The Beijing Xicheng District People’s Court said that Mr. Hong, a former executive editor of the history journal Yanhuang Chunqiu, had defamed the heroes, and that he should apologize publicly on websites and news outlets to the sons of two of the five men, who sued Mr. Hong last August.