American actress and singer Selena Gomez sparked a controversy after she posted a picture of herself on Instagram, flashing her ankle inside the Sheikh Zayed Grand Mosque in Abu Dhabi, United Arab Emirates.

According to the mosque's official website, visitor's should strictly follow the dress code.

"Long, loose fitting, ankle length trousers or skirts for women and men. Women must wear a headscarf," the post read.

The 22-year-old former Disney star posted another photo with Kendall Jenner, Gigi Hadid, Cody Simpson, Shay Mitchell and more friends, in different poses at the mosque.

Though the Come and Get It singer deleted the controversial image from the photo sharing website, she received backlash from Instagram users.

A user youssi_yoyo wrote: "Please respect yourselves! This isn't a place to take pictures like this. It's a holy place where u should be polite and respect yourself. #itsallaboutrespect."

Another user tabaan wrote: "They look like they couldn't care less where they take the photo, literally it's a mosque not a dress up party."

However, Hadid apologised for their behaviour stating that they had no intentions to hurt anyone's feelings.

She wrote to a fan in a series of tweets: "We were with many people from the Mosque and were always checking to make sure we were being respectful. Please trust that... we understand the importance of the Mosque to many, including myself coming from a Muslim father... I'd never let a group im with disrespect, let alone be friends with people that'd be disrespectful in any place of worship."