(CNN) French children will have to leave their smartphones and smart devices at home or switched off when they are at school starting in September.

The ban on smartphones as well as other kinds of internet-connected devices, such as tablets, applies to schoolchildren between 3 and 15 years of age, and was passed by lawmakers on Monday. French high schools, or lycées, with students 15 and older, will get to choose whether to adopt the phone ban for their pupils.

"We know today that there is a phenomenon of screen addiction, the phenomenon of bad mobile phone use... Our main role is to protect children and adolescents. It is a fundamental role of education, and this law allows it," said Education Minister Jean-Michel Blanquer on French news channel BFMTV

The law fulfills one of President Emmanuel Macron's campaign promises. It passed 62 votes to one, supported by members of Macron's centrist La République en Marche! party. Some lawmakers from the right and the left abstained, claiming the law would change little.

"This isn't a 21st century law in our eyes, but a law from the era of news channels and binary debate," said Alexis Corbière, a deputy from the left-wing Unbowed France party and a former teacher.