The Osaka District Court has ruled that a prefectural ordinance obliging teachers to stand and sing the national anthem during school ceremonies is constitutional, rejecting a lawsuit filed by a teacher saying the rule violates freedom of thought.

It is the first time the court has handed down a ruling in connection with the 2011 Osaka ordinance regarding "Kimigayo," which includes lines wishing for the eternal reign of the Emperor that are seen by some as a symbol of Japan's past militarism.

Presiding Judge Hiroyuki Naito said in the ruling Monday that orders from the teacher's superiors to follow the ordinance "indirectly restricted" the constitutional right of freedom of thought and conscience, but they were necessary for "the smooth progress of the ceremonies to an allowable extent."