While Mr Ahmadinejad may want to believe that his Islamic society is exclusively non-gay, it is a belief undermined by the paradox that transsexuality and sex changes are tolerated and encouraged under Iran's theocratic system.

Iran has between 15,000 and 20,000 transsexuals, according to official statistics, although unofficial estimates put the figure at up to 150,000. Iran carries out more gender change operations than any country in the world besides Thailand.

Sex changes have been legal since the late Ayatollah Ruhollah Khomeini, spiritual leader of the 1979 Islamic revolution, passed a fatwa authorising them nearly 25 years ago. Whereas homosexuality is considered a sin, transsexuality is categorised as an illness subject to cure.

While the government seeks to keep its approval quiet, state support has increased since Mr Ahmadinejad took office in 2005. His government has begun providing grants of £2,250 for operations and further funding for hormone therapy. It is also proposing loans of up to £2,750 to allow those undergoing surgery to start their own businesses.

Maryam Khatoon Molkara, leader of the country's main transsexual organisation, said some of those undergoing operations were gay rather than out-and-out transsexuals. "In Iran, transsexuals are part of the homosexual family. Is it possible that a phenomenon exists in the world but not in Iran? Transsexuality is a real disaster. It's a one-way street. But if somebody wants to study, have a future and live like others they should go through this surgery."

At Columbia University on Monday, Mr Ahmadinejad said homosexuality did not exist in Iran. "In Iran we don't have homosexuals like in your country," he told a questioner who accused his government of executing gay people. "In Iran we do not have this phenomenon. I don't know who has told you that we have it."

But Ms Molkara - who persuaded Khomeini to issue the fatwa on transsexuality - said his stance was inconsistent with the state's sex-change policy. "They are saying homosexuality doesn't exist, but they have never given me a chance to use my influence among transsexuals to prevent transsexuality from happening," she said. "You could change the culture but the press and state TV are not allowed to write or say anything about transsexuality."

The president's claim was an eye-opener to Iranian human rights lawyers, who said the country's Islamic legal code made draconian provision for homosexual offences by men and women.

It also outraged international gay rights activists, who recalled numerous executions under Iran's sodomy laws. When legal officials announced the execution of 12 prisoners at Tehran's Evin prison in July, they said the condemned included several "sodomites". According to campaigners, several gay men have been caught up in a wave of hangings over the summer, although the claims are hard to verify.

There have been other high-profile cases in recent years, including that of two teenagers, Mahmoud Asgari and Ayaz Marhoni, who were publicly hanged in the north-eastern city of Mashhad in the summer of 2005 after admitting having sex. This summer, Pegah Emambakhsh, an Iranian lesbian, was granted permission to take her case to the court of appeal in Britain after claiming she would be in danger of execution if the Home Office implemented its ruling to deport her to Iran.

"Homosexuality is defined both for men and women in law. There is a section devoted to homosexuality," Shirin Ebadi, the Nobel peace prize-winning human rights lawyer, said. "There is one part for homosexuality in men, which is called lavat [sodomy], which is punishable by death. There is another for women, which is called mosahegheh. If the crime is committed up to three times, the penalty is 100 lashes. On the fourth, it is execution."