Police were called to a school after a pupil was seen posing with an AK-47 machine gun on Facebook a few days after the Paris terrorist attacks.

The student, aged 13 or 14, was seen smiling and holding the weapon with his finger on the trigger on his profile photo, understood to have been taken while on a visit to Pakistan this year.

It was spotted by teachers at Royton and Crompton School in Oldham, Greater Manchester, on Monday after the boy overlaid the French flag on his profile image to show respect to those who died in the Paris attacks last Friday.

Some parents reportedly pulled their children out of school after seeing the photo.

The boy and his family were said to be “hugely upset” at the offence caused and deleted the photo but the image is still online on some Facebook pages showing the boy’s face.

The headteacher wrote to concerned parents telling them police had been contacted over the photo, which was posted online in August. Greater Manchester police confirmed no criminal offence had taken place.

In the letter to parents, headteacher Dr Kevin O’Hagan said he immediately contacted the boy’s parents when the school was made aware of the image and the council and police were also informed.

He wrote: “The child and family were fully co-operative and are hugely upset that offence has been caused.

“They stressed their disgust at the Paris attacks, quickly deleted the Facebook account and wish to express their regret at what happened.

“I hope you are assured that the safety of all pupils and staff is our highest priority at this school and I want to take this opportunity to reassure all parents and carers that your children are completely safe here.

“The incident is a reminder of the need to use social media appropriately and safely at all times and we will, of course, continue to teach children about how to do this.”

A police spokeswoman said: “Greater Manchester police has been made aware of an image on a social media site.

“The image has since been removed and police have spoken to the individuals concerned where it was deemed no offences have taken place.”