First off i am impressed that you know my country of origin lol . And yes the most likely threats towards me will come from the overall population whom are religious . And do not give a damn whether i am canadian or not . For them you are still a local no matter what.on the other hand I can be freely gay right now when it comes to the state and its laws,regulations against the lgbtq community as i hold a Canadian passport. I am surprise that you know much about it maybr because you are a lawyer or you visited there .OP's handle suggests he's north African.
Can't speak for Libya, a country that hasn't been stable for a long time, but I have a hard time imagining, say, Tunisia or Morocco emprisoning a Canadian citizen and risking a diplomatic row over it and a condemnation from Canada's allies (US, UE...). Doesn't seem worth it.
It should be taken with a grain of salt, but the passport should provide "some" protection from the state.
The reaction of the population may be a different story, but I suppose OP is already well aware of that already.
There are neighborhoods filled with gay people mostly foreigners and the state would never bother nor assaulting them since it is part of the tourism sector and bring money with them.as you said now as s canadian they would think twice before persecuting me .
I give you a big up for having such knowledge about north africa
You made my day