There were violent protests against the men in the form of abuse and throwing of stones as they were escorted into an armored prison vehicle after the hearing. This resulted in tear-gas firing by the police.
On August 4, the youngsters; mostly in their 20s, were arrested in a Bauchi hotel. According to reports by the police, the men were dressed as women, which is incidentally, illegal under the state's sharia penal code. The punishment by the religious court for the offence amounts to a year in prison and 20 lashes by cane.
The accused, who tried to hide their faces as they were booed on their way in and out of court, refute the charges. They claim they went to the hotel for a graduation party.
Muhammad Bununu of the Hisbah Commission, a body charged with enforcing sharia law in the state, told media persons that the accused were "addressing each other as women and dressing themselves as women.
"They said they went to the hotel to witness a wedding between a male and a male," Bununu added.
As court evidence, the police produced handbags and suitcases containing women's high-heel shoes and clothing.However, the 18 are not yet formally charged with homosexuality.
Homosexuality is illegal in Nigeria and considered immoral by the vast majority of people, both Muslims and Christians.
Bauchi is one of 12 states in the predominantly Muslim north that started a stricter enforcement of sharia law in 2000. This decision alienated a large section of Christian minorities and sparked bouts of sectarian violence that killed thousands.
Sharia courts have been active for centuries but under British colonial rule their powers were curtailed. In the 12 states, they have regained the right to impose strict punishments such as death for adultery or sodomy and amputation for theft.
So far, just one man, a convicted murderer hanged in 2002, is known to have been executed under sharia law since it was reinforced in the 12 states.
As the Nigerian media had originally reported that the 18 men arrested in Bauchi were charged with sodomy and could face death by stoning, there were concerns raised by human rights groups who sent observers to Tuesday's hearings.Bununu denies the reports.
Judge Tanimu Abubakar has adjourned the case up to September 13. This is to allow time for a Bauchi state prosecutor who is taking over from the police, to familiarize himself with the evidence.