A doctor and freelance journalist imprisoned in northern Iraq for writing about homosexuality has been pardoned and released.

Adel Hussein was sentenced in November to six months in prison and a fine of about $100 on a charge of violating "public custom."

He was released from a prison in Irbil, about 350 km north of Baghdad, after receiving a pardon from Massoud Barzani, president of the Kurdish region.

The president said on his website he had pardoned 121 people in advance of the Muslim celebration of Eid al-Adha, one of Islam's most important holidays.

Hussein said he wrote the article on the physical effects of homosexuality, published in an April 2007 issue of the independent weekly Hawlati, to educate the public.

"The Kurdish society of the Middle East lacks enough education about sex and I intended to offer that education," he said.

"The Kurdish society is still a closed one and cannot accept open discussions of such subjects, and that is why I was arrested."

Swearing off sex

Hussein has published three books about sex, including Sex of 200 People, which was published in 2005, without previous trouble with the law.

He said it was "painful" to be imprisoned and he has been discouraged from writing such educational articles. "I won't write about sex again," he said. "It is very painful for me to be arrested for writing about a scientific subject."

However, Hawlati's editor, Kamal Raouf, vowed to keep publishing articles on all kinds of subjects, including controversial ones.

 Hussein's lawyer, Luqman Malazadah, said the Kurdish court convicted him based on an outdated 1969 Iraqi penal code and should have applied a new law that took effect in October.

The New York-based Committee to Protect Journalists, which had campaigned on Hussein's behalf, welcomed the pardon.

"We are relieved that President Barzani intervened to right this injustice," said CPJ deputy director Robert Mahoney in a statement released Wednesday.

"We call on the authorities to ensure that the new legislation is enforced and that Adel Hussein is the last journalist to be sent to prison in Iraqi Kurdistan because of his work."

With files from the Associated Press