Ricky Martin flipped the pronouns in a song while performing in Morocco, singing about a gay lover despite homosexuality being criminalised.

During the performance at the Mawazine music festival in Raba, Morocco last Friday, the singer performed the hit ‘She’s All I Ever Had’.

However, halfway through the song the openly gay singer began to flip the lyrics to ‘he’, singing: “It’s the way he makes me feel/It’s the only thing that’s real It’s the way he understands/He’s my lover, he’s my friend/When I look into his eyes it’s the way I feel inside /Like the man I want to be/He’s all I ever need.”

Later, after spotting some fans waving a rainbow flag in the air, he said: “What a beautiful rainbow flag right there.”

Homosexuality is criminalised in Morocco in both men and women, with Article 489 of the Penal Code of banning “lewd or unnatural acts with an individual of the same sex”.

Homosexual conduct can result in a prison sentence of between 6 months and 3 years.

The large annual music festival drew a crowd of around 100,000 people.

Ricky Martin came out as gay in 2010, and celebrated doing so, by releasing a video which showed the Puerto Rican singer naked, waking up and coming to life as messages such as “find yourself” and “change your life” appear on his skin.

Watch the performance below: