The boy is charged in Butler County with attempted murder, felonious assault, inducing panic and making terror threats.

With his ankles shackled, he sat silently during the brief hearing and kept his head down, reading the complaint.

Defence lawyer Ed Perry entered a denial of the charges, and a magistrate ordered that the suspect remain in juvenile detention pending a hearing on April 5. Mr Perry and the boy's supporters declined to comment afterwards.

There was no indication whether prosecutors might seek to move the case to an adult court.

Authorities allege the boy fired at students on Monday in a canteen used by high-school pupils in Madison Township, near Middletown.

Two students were shot and two others were hurt, possibly by shrapnel or while running away, authorities said. The injuries were not considered life-threatening.

In a recorded call, a 911 caller reporting the shooting immediately identified the suspect by name. Breathing heavily, the unidentified caller told a dispatcher: "He just pulled out his gun and started shooting."

Sheriff Richard Jones said he is aware of a motive but was not ready to release it.

Students were eating in the cafeteria when the shooting happened at around 11.30am, Mr Jones said.

A sheriff's deputy stationed in the school had just been in the cafeteria, he added.

The students who were shot were 14 and 15 years old and were taken to a hospital where they were in stable condition.

The school, which had carried out drills for such an event, immediately went into lockdown, Madison Local Schools spokeswoman AJ Huff said.

The district cancelled classes and extracurricular activities on Tuesday.