A 17-year-old boy accused of throwing an incendiary device on to a motorway, causing a major shutdown, has also been accused of blackmailing a school for thousands of pounds, a court has heard.

The teenager, from Winchester, appeared at Basingstoke Youth Court accused of two counts of arson with intent to endanger life and two of causing danger to road users in relation to incidents on the M3 on September 16 and 23.

Hampshire Police said a potentially hazardous substance was thrown from a motorway bridge near Winchester on September 23.

The M3, the main road between London and Southampton, was closed between junctions 9 and 11 from just before 4am until after 3pm.

The defendant, who cannot be named because of his age, is also accused of carrying out eight offences of burglary against a school during which computer equipment of an unknown value was stolen.

He is also accused of two charges of blackmail with menaces against the same school each demanding payment of £10,000 in the online currency bitcoin.

The defendant faces two further charges of theft of miscellaneous items from a Tesco supermarket on the days preceding the two motorway incidents.

Chairman of the panel of magistrates Thura Win committed the case to be heard at Winchester Crown Court and remanded the defendant to youth detention until the next hearing on October 11.

He told the teenager, who was supported in court by his father, said: "We are going to remand you to youth detention accommodation. You will next appear at Winchester Crown Court."

Social media users shared pictures of the scene near Winchester on September 23, with one showing a man walking his dog on the hard shoulder, others playing golf, and another doing a handstand on the carriageway.

Bomb disposal experts were called to the scene but police later said the substance was flammable, not explosive.

There was a similar incident on the same bridge, which leads to St Catherine's Hill, at around 4am on Saturday September 16.

On that occasion, police received reports of something being dropped on to the carriageway and that an object was alight, but when officers attended they found only broken glass and no fire.

James Burnham, prosecuting, described the items as incendiary devices and said the impact of the closure would have led to a cost of millions of pounds.

Michael Lane, Police and Crime Commissioner for Hampshire and the Isle of Wight, said: "The unexpected nearly always involves one or more partners urgently taking action to keep us safer – involving the emergency services, air ambulance, road repair and clearance and all the processes of signposting and diversion to safer and clear routes.

"In the congestion that exists in our area, this will often be complex as interrelated activity needs to be adjusted – planned work on minor roads, relying on the main arterials to keep traffic free flowing, become constraints on diversions as the messages of an incident inform satellite navigation systems in cars and seek alternative routes.

"Good planning is defeated by the act, on this occasion, of criminal and dangerous activity.

"Lessons can and will be learned amongst partners.

"But I hope that people will share my determination that safety must always come first."