The United Arab Emirates has released two young men it detained over a selfie they took in front of a New Year's Eve hotel fire.

The state-run WAM news agency reported the news late on Friday, citing Essam al-Humaidan, the attorney general of the emirate of Dubai.

He said the two unidentified men were released after investigators found "no evidence of criminal intent".

He also called for "caution and discretion when posting any material on social media" and for people to "refrain from spreading rumours, defaming others or violating other people's freedom so that they do not breach any laws".

The 63-storey Address Downtown luxury hotel caught fire just before a fireworks display at the nearby Burj Khalifa, the world's tallest building. The hotel burned through the fireworks display and into the new year.

Under the UAE's cybercrime laws, people can be arrested, imprisoned and deported for taking photographs without the consent of those shown.

Writing on Twitter, Sultan Sooud Al Qassemi, a UAE-based political commentator, called the detentions "unnecessary" and "bad PR to say the least".

Source: Al Jazeera and agencies