Well-known Senegalese journalist Jupiter Tamsir Ndiaye may be jailed for two years for "acts against nature" in an assault case being heard in Dakar.
Ndiaye was involved in a fight with another man, Matar Diop Diagne, allegedly over payment for sex, reports the Senegalese News Agency.
Diagne alleges that Ndiaye offered to pay him 100,000 Senegal francs but after having sex in Ndiaye's office he was only offered 5,000 francs.
A fight ensued and Ndiaye allegedly stabbed Diagne in the stomach.
Ndiaye told the court on Wednesday that the knife was not an illegal weapon but was used in his office for breakfast. He also said that he only intended to frighten Diagne with the knife and that the stabbing was accidental.
In addition to the charges of assault and battery and illegal possession of a weapon, Ndiaye has also been charged with the gay sexual encounter, with the prosecutor demanding that he serve two years in prison.
"We had sex. It was spontaneous situation. I do not have homosexual inclinations," Ndiaye, who is married to a woman, told the judge. "I was drunk. I do not know what happened."
Diagne, for his part, claims that he was "led into homosexuality" by Ndiaye.
Same-sex sexual activity is illegal in Senegal under article 319 of the penal code which punishes "improper or unnatural" acts with jail time of between one and five years.
Ndiaye's lawyer has argued that article 319 does not specifically define homosexuality as being "improper or unnatural".
The case, which has become a media sensation in Senegal, will continue on 24 October.