Military service is mandatory for all Turkish men - they can only escape it if they are ill, disabled or homosexual. But proving homosexuality is a humiliating ordeal.

''They asked me when I first had anal intercourse, oral sex, what sort of toys I played with as a child."

Ahmet, a young man in his 20s, told officials he was gay at the first opportunity after he was called up, as he and other conscripts underwent a health check.

"They asked me if I liked football, whether I wore woman's clothes or used woman's perfume," he says.

''I had a few days' beard and I am a masculine guy - they told me I didn't look like a normal gay man.''

He was then asked to provide a picture of himself dressed as a woman.

The face must be visible, and the photos must show you as the passive partner Gokhan, Exempted from military service on grounds of homosexuality

''I refused this request,'' he says. ''But I made them another offer, which they accepted.'' Instead he gave them a photograph of himself kissing another man.

Ahmet hopes this will give him what he needs - a "pink certificate", which will declare him homosexual and therefore exempt from military service.

Over the years, gay life has been becoming more visible in Turkey's big cities. Cafes and clubs with an openly gay clientele have been opening in Istanbul, and last summer's gay pride march - unique in the Muslim world - was the largest ever.

But while there are no specific laws against homosexuality in Turkey, openly gay men are not welcome in the army. At the same time, they have to "prove" their homosexuality in order to avoid military service.

Gokhan, conscripted in the late 1990s, very quickly realised that he was not made for the army.

''I had a fear of guns,'' he reminisces.

Image caption Last summer's gay pride march in Istanbul was the largest ever held in Turkey

As a gay man he was also afraid of being bullied, and after little more than a week he plucked up the courage to declare his sexual orientation to his commander.

''They asked me if I had any photographs.'' Gokhan says, ''And I did.''

He had gone prepared with explicit photographs of himself having sex with another man, having heard that it would be impossible to get out of military service without them.

''The face must be visible,'' says Gokhan. ''And the photos must show you as the passive partner.''

The photographs satisfied the military doctors. Gokhan was handed his pink certificate and exempted from military service. But it was a terrible experience, he says,

''And it's still terrible. Because somebody holds those photographs. They can show them at my village, to my parents, my relatives.''

Find out more Emre Azizlerli's documentary The Pink Certificate will be broadcast on BBC World Service on 26 March 2011 Download the podcast More on BBC World Service

Gay men say the precise nature of the evidence demanded depends on the whim of the military doctor or commander. Sometimes, instead of photographs, doctors rely on a "personality test".

The Turkish army refused BBC requests for an interview, but a retired general, Armagan Kuloglu, agreed to comment.

Openly gay men in the army would cause "disciplinary problems", he says, and would be impractical creating the need for "separate facilities, separate dormitories, showers, training areas".

He says that if a gay man keeps his sexuality secret, he can serve - an echo of the US military's recently dropped Don't Ask Don't Tell policy.

"But when someone comes out and says he is gay, then the army needs to make sure that he is truly gay, and not simply lying to evade his mandatory duty to serve in the military.''

If I have to fulfil a duty for this nation, they should give me a non-military choice Ahmet

The social stigma associated with homosexuality in Turkey is such that outside the young and urbanised circles in big cities like Istanbul and Ankara, it is hard to imagine a man declaring that he's gay when he's not.

However, the possibility causes the military a lot of anxiety.

"Doctors are coming under immense pressure from their commanders to diagnose homosexuality, and they obey, even though there really are no diagnostic tools to determine sexual orientation,'' says one psychiatrist who formerly worked at a military hospital.

''It is medically impossible, and not at all ethical."

On Gokhan's pink certificate, his status reads: ''psychosexual disorder''. And next to that, in brackets, ''homosexuality''.

Turkey's military hospitals still define homosexuality as an illness, taking a 1968 version of a document by the American Psychiatric Association as their guide.

The Turkish army More than 660,000 soldiers in total - 201,782 professional, 458,768 conscripts

Military service is mandatory for all men over the age of 20

There is no right to be a conscientious objector

Women do not do military service

For those without a university degree, service lasts 15 months

Those with a university degree are either reserve officers for 12 months, or privates for six months

Some people in Turkey say with resentment that gay men are actually lucky, as at least they have one possible route out of military service - they don't have to spend months in the barracks, or face the possibility of being deployed to fight against Kurdish militants.

But for openly gay men, life can be far from easy.

It is not uncommon for employers in Turkey to question job applicants about their military service - and a pink certificate can mean a job rejection.

One of Gokhan's employers found out about it not by asking Gokhan himself but by asking the army.

After that, he says, he was bullied. His co-workers made derogatory comments as he walked past, others refused to talk to him.

''But I am not ashamed. It is not my shame," he says.

Ahmet is still waiting for his case to be resolved. The army has postponed its decision on his pink certificate for another year.

Ahmet thinks it is because he refused to appear before them in woman's clothes. And he doesn't know what to expect when he appears in front of them again.

Could he not just do his military service and keep his homosexuality a secret? ''No,'' says Ahmet, firmly.

''I am against the whole military system. If I have to fulfil a duty for this nation, they should give me a non-military choice.''

Some names have been changed to protect the identity of interviewees. Emre Azizlerli's documentary The Pink Certificate will be broadcast onBBC World Serviceon 27 March 2011.