Two gay men from Morocco have been sentenced to four-months in jail each for posing too close in a photograph.

The men, only identified by the Guardian as Lahcen, 38 and Mohsine, 25, in order to protect their identities, were on Friday found guilty of obscenity and homosexuality.

The men posed for a photograph at a historic site in Rabat earlier in June, in front of a minaret, a popular tourist spot.

As well as the jail sentences, the men were ordered to pay fines of 500 dirhams (£33).

The Aswat Collective, Morocco’s leading LGBT rights group, released a statement saying: “These men will be spending the next months behind bars for one, and only one, reason: being gay… We are outraged by this injustice.”

A day before the men were arrested, two protesters from the group Femen were arrested in the same place for posing topless in front of the minaret.

Mohsine and Lahcen were accused by authorities of mimicking the photograph by Femen, but they denied the accusation.

While journalists were denied access to the trial of the two men, activists in Morocco say they were subjected to mental and physical abuse.

Families of the men have expressed fears that they may face violence in jail, now that the details of the trial have been made public by the local media.

Ray Cole, a gay British man, was briefly jailed in the country last year under Morocco’s anti-gay laws.

Mr Cole and his Moroccan friend were subsequently released following a high-profile campaign.

Moroccan law penalises what it refers to as acts of “sexual deviancy” between members of the same sex, a term that police reports and court documents use to refer to homosexuality more generally.

Campaigners earlier this year condemned the jailing of two men accused of consensual same-sex activity in Morocco.

Last month three men in Morrocco accused of homosexuality were jailed for three years each.