I never thought I’d find a boyfriend in Iran. After all, homosexuality is technically illegal here.

Consensual sex between two adult males is punishable by death. Tafkhiz - defined as the rubbing together of thighs or buttocks - is punishable by 100 lashes.

If two men not related by blood are found “under one cover without necessity” they can be given 99 lashes (for some reason the same offence with two women is 100 lashes). Curiously, “lustful” kissing between two men is punishable by only 60 lashes.

Despite this draconian statutory prohibition, homosexuality is an open secret. My friends tell me that since President Mahmoud Ahmadinejad - who infamously denied the existence of gay people in Iran - left office, there has been a thaw in official policy towards LGBT (lesbian, gay, bisexual and transgender) people.

More and more, I see gay and lesbian couples being openly affectionate on the streets. Transgender individuals live and work openly in Tehran, the government will even pay for sex reassignment surgery for those who want it. Gay hook-up apps like Grindr, Scruff, and Hornet are easy to access and increasing in popularity.

The government even offers an exemption from compulsory military service for men who have sex with men. They classify it as a mental illness, but at least this is an acknowledgement.

In recent years small pockets of gay public life have established themselves around the city. Most nights a well known park near the City Theatre and the university of Tehran becomes a vibrant cruising ground for gay men. They come to trawl the park, to look, to show off, exchanging furtive glances in the dark, occasionally meeting for a few minutes in the public facilities or heading to some third location for more comprehensive interaction.

Gay couples recline in remote corners, arms around each other, stealing kisses. Sometimes I don’t even see them until I’m alerted by their giggles. If you sit on a bench and have a certain look, eventually someone will sit next you and offer a knowing “khaste nabashi” - a common greeting - that depending on your mood and the moonlight can lead anywhere.

Down Revolution Street, men lean against the shuttered store front of the Institute For The Compilation and Publication of the Works of Imam Khomeini making eyes at passing motorists. Sometimes a car stops, a conversation ensues through a rolled-down window, someone gets in, and off they will go to perform acts punishable by violent flogging.

Police do patrol the park, going about in packs of three and four, but they seem to show little interest in disrupting proceedings.

“The police can’t do anything,” said one man I met in the park. He was wearing women’s shoes, heavy make-up, with a jewelled barrette in his hair and a small black leather purse in the crook of his elbow. “You need three people over the age of eighteen to go to court and swear on the Qur’an that they actually saw you having sex.” As he spoke he had his arm around his male friend’s waist.

“It’s not the police I’m worried about,” said another. “It’s the reaction of the people that’s unpredictable, they’re so homophobic.”

It’s not the police or the mullahs who are the biggest obstacles to having a successful homosexual relationship in Iran. It’s the utter lack of opportunities for any kind of intimate contact with your significant other. This is a combination of two factors: the first is that most unmarried Iranian men seem to live with their families, the second is that public spaces are no-go zones for anything above hand-holding. Every relationship I’ve pursued has run into this problem.

There was M, a 26-year-old branding and advertising consultant who lived with his parents and sister. We used to meet at the movie theatre and make out in the back row, but it was usually too crowded to attempt anything more serious.

There was P, a 30-year-old waiter who lived with his grandmother. We would get a hotel room sometimes, but he always insisted on going in separately and besides it got to be way too expensive.

And then there was A, my boyfriend. I met him at a party at a villa in Lahejan, near the Caspian Sea. We were both pretty sloshed on arak cocktails. He was wearing a ‘93 Bulls Michael Jordan T-shirt and green camouflage pants. His hair was dyed red and he had a scar across the whole right side of his head, which I later found out was from a piece of shrapnel when a motorcycle engine exploded.

From the moment I saw him, I knew in the marrow of my spine. There was just no question about it. The infinite possibilities of the universe collapsed in that moment into a singular inescapable fact: we were going to have sex. I wasn’t sure when or where exactly, but I knew it would happen. I was so certain that I didn’t even feel the need to pursue it. This was a done deal.

We made heavy eyes at each other the across the room. He came over and we had a forgettable conversation laden with pregnant pauses, lingering eye contact, and lots of incidental touching. When we were finally able to get into a room by ourselves, we didn’t even need to say anything, we just started making out.

That lasted about a minute. Then we heard the doorknob turning and A ripped himself away from me and pretended to be looking at a pile of papers on the desk as one of our friends walked in. I was left standing not sure what gear to be in. I didn’t know it then but that initial encounter was emblematic of our relationship.

When we walk in public, he refuses to let me hold his hand or even walk too close to him. Kissing or other public displays of affection are off limits. Occasionally when we spend a long weekend in one of our friends’ houses in Oshun or Lavasan, we manage to abscond to a bedroom with a locked door and yet he is still preoccupied by the notion that “someone might see us”.

I can’t count how many time I’ve been forced to bail mid-make out and pretend to be sleeping because he has heard footsteps down the hall. Sometimes he’ll do ridiculous things like sit at the opposite end of a long dinner table just for appearances. When he does that, I wink at him from across the table just to watch him get flustered.

“I’m a bit paranoid, I don’t know why, I know it’s not a big deal,” he tells me. “But I just can’t help it.” A has never even considered telling his father, a working-class house painter and devout Muslim, about his sexual orientation. “It’s not the same here, people don’t understand.”

Even among our friends - who take absolutely no issue with homosexuality and who have expressed their support - he bristles when I try to be affectionate. When we walk through the Gay park he takes a step away from me. “We can’t touch here,” he says. “This is the gay part of town, everyone will know.”

Despite these issues, I’ve decided to pursue the relationship, and in every other respect it’s been great. When I met A, being just a stupid khareji (foreigner) I’d mostly been exposed to overpriced cafés in Tajrish and the posh high rises of Niavaran.

A has shown me another side of Tehran. He took me to the south, to the old parts, to Gomrok, Berynak and Doolab. He showed me around his neighbourhood of Darveseh Dolat, down narrow winding alleys, past buildings that haven’t changed in a generation. We went to the local Sufi khanegah (‘institute’), tucked away in dark side street, to see their ecstatic religious dancing.

He showed me how to light candles in the sagh-e khane, little alcoves built into walls around the city that are usually covered by metal bars and may feature an image of an Imam or famous martyr. I rode around Haft-e Tir and Enghelab on the back of his motor scooter. He took me to the avant-garde studios of young artists where we smoked hash and engaged in meandering discussions of Bruce Nauman and abstract expressionism.

We have talked about all the trips we plan on taking, to Mashhad, and Esfahan, and Bandar Abbas, about how we are going to buy a motorcycle and ride it to India together. None of which we have actually done. But still it is magical. Everything is great, but we have kept running into one big problem: intimacy. The whole first month we were dating, we spent most days together but we managed to have sex only once.

No matter how well things are going in our relationship, there’s always an 800lb gorilla in the room. We say we love each other regularly, we call each other azizam (my darling) - when no one is listening of course - and all I want to do is grab him and kiss him when we greet each other but we have to pretend we’re just friends because he has a debilitating fear of stigma, because he’s grown up in a society that systematically delegitimises our sexual orientation.

The constant code switching is dizzying. One minute we’re in the shower together, the next minute we’re sitting on opposite ends of an empty couch. I grew up in Los Angeles, and have been living in New York, so there’s simply no way for me to empathise with the years of destructive internalisation that he must have experienced growing up gay in the Islamic republic. I try to sympathise, but at times it’s just too frustrating.

“Things are definitely getting better,” said Sina, a gay 32-year-old Tehrani, “but we never touch and kiss in public.”

I’ve met a lot of nice gay men in my time in Tehran. I’ve loved at least one of them. And yet I have not been able to find one who has ever introduced a boyfriend to his parents. It’s striking how universal it is. Men in their 30s who are successful, well-adjusted, and live alone: they still would never consider telling their parents about their sexual orientation.

This is the strange grey area that gay men in Iran find themselves in. The government appears to be loosening its grip, it’s becoming easier for LGBT people to move in Iranian society without fear of arrest and prosecution, but a deeply engrained shame lingers, stunting the development of a truly ‘out’ LGBT culture.

“We all want to be more open in public,” A said to me once, “but it’s just not the proper place or the proper time.”