In the daily battle to capture and hold pupils’ attention, teachers in one region of Spain are getting a little help from the state. As of this month, a new law in Castilla-La Mancha prohibits schoolchildren from bringing smartphones and similar devices into classrooms.

For many schools in the region, the legislation simply gives legal backing to rules they have had in place for years. Now any pupil caught sneaking their phones into class will face losing their break-time privileges or, in the case of repeat offenders, detention.

The law follows teachers’ complaints of constant interruptions in class as well as concerns about the use of phones to cheat, said Jesús Martínez, headteacher of Fernando de Rojas state school. In recent years, with phones becoming an ubiquitous part of teenagers’ lives, teachers have also become worried about the increasing prevalence of cyberbullying, he said.

His school banned phones years ago, but pupils continue to sneak them in. “This law gives us a bit of support in what we’re trying to do,” he told Cadena SER radio.

The regional law does allow for some exceptions. Any teachers interested in incorporating mobiles into lessons can ask for permission to bring electronic devices into the classroom.

In 2014, an Ipsos poll found that 94% of Spaniards between 16 and 35 had a mobile, with 56% of students admitting to using their phone during class despite bans. In the northern region of Galicia authorities are debating whether a similar schoolwide ban on phones is needed, while many schools are taking it upon themselves to crack down on mobiles in the classroom.

But in the face of increasing prohibition, some are bucking the trend. In the Torre del Palau school in Terrassa, Catalonia, mobile phones have become part of the curriculum. “It’s better to join forces with the enemy,” the headteacher, Evaristo González, recently told teachers at a conference.

Four years ago, the school’s authorities decided to allow mobiles into the classroom, with the condition that students keep their phones on silent and tucked away in their rucksacks. During classes such as Digital media and communication, students are encouraged to use their phones to create apps or record videos.

“In today’s reality, information comes from all sorts of sources. Our education system has to be based on this reality,” said González. “This isn’t the future. It’s the present.”