The case drew thousands of protesters to the court, who threw stones at the men as they were being transported back to prison after the trial, as security forces fired into the air to disperse the angry crowd.
The men were arrested by the Bauchi State Sharia Commission for allegedly engaging in homosexual activities, acts that contravene the Islamic laws which the state had been operating under since 2001.
The men were named as Shehu Adamu, Yusuf Adamu, Aliyu Dalhatu, Abdulmalik Tanko, Usman Sabo and Hazif Sabo Abubakar and Ibrahim Marafa.
It was the first case since President Goodluck Jonathan signed a bill that criminalises same-sex relationships, defying Western pressure over gay rights and provoking criticism from the United States.
The bill, which contains penalties of up to 14 years in prison and bans gay marriage, same-sex “amorous relationships” and membership of gay rights groups, was passed by the National Assembly last May but Jonathan had delayed signing it into law until early January.
At Thursday’s trial, the prosecuting lawyer said the case was a direct result of the recently-passed law.
“This is further to the law against homosexuals which was signed by the President. It has to be implemented. People caught breaking this law must be prosecuted accordingly,” said Danlami Ayuba.
The trial was adjourned to January 27.
As in much of sub-Saharan Africa, anti-gay sentiment and persecution of homosexuals is rife in Nigeria, so the new legislation is likely to be popular.
While European countries, most recently France, have moved to offer same-sex couples the same legal rights enjoyed by heterosexuals, many African countries are seeking to tighten laws against homosexuality.
Britain and some other Western countries have threatened to cut aid to governments that pass laws persecuting homosexuals, a threat that has helped hold back or scupper such legislation in aid-dependent nations like Uganda and Malawi.
But they have little leverage over Nigeria, whose budget is funded by its 2-million-barrel-per-day oil output.