Three Muslim extremists holed up in a building in southern Gaza surrendered to Hamas police after nightfall Wednesday, ending a rare challenge to the territory's militant Islamic rulers.

Hamas officials said the Jund Ansar Allah militants left the building in the southern city of Khan Younis quietly after a daylong siege. Muslim clerics negotiated the surrender, they said. Police said the three were not carrying arms. Reporters were kept away.

Jund Ansar Allah claims inspiration from Al Qaeda, but no ties have been confirmed

Residents said five Hamas jeeps surrounded the area during the siege, and Hamas police set up a checkpoint leading to the building. It was not clear why the men were wanted. Earlier reports said four men were inside, but the discrepancy was not immediately explained.

Hamas, a violently anti-Israel group backed by Syria and Iran, seized power in Gaza more than two years ago and has ruled with a firm hand. However, a small number of shadowy extremist groups have emerged as an opposition of sorts, seeking to enforce an even stricter version of Islamic law.

Jund Ansar Allah, or the Soldiers of the Companions of God, came to public attention in June after it claimed responsibility for a failed attempt to attack Israel from Gaza on horseback. It is unclear how many members it and similar extremist groups in Gaza have.

The groups have criticized Hamas for not imposing Muslim law in Gaza and are upset that the Hamas regime has honored a cease-fire with Israel for the past six months.

Hamas has said it seeks to set an example and does not impose its views on others. It also says its violent struggle is against Israel, not the Western world.

The hard-line groups are perhaps the most serious opposition to Hamas, which has crushed the influence of its main rival, Fatah, since taking power in a 5-day civil war in June 2007.